Sunday, April 30, 2006

Linux User Reviews Chicken Scheme

Linux User has a review of the Chicken Scheme Compiler/Interpreter. There is only 1.5 pages of text with a barely readable small green font on black screendump. Not much to impress someone unfamiliar with Lispy languages. However, I did see the word elegant so I guess it is a favourable review. This is the only magazine I have seen with periodic Lispy articles.

Sunday, February 26, 2006

Scheme Sudoku Solver



There is a Sudoku craze. Puzzles abound in books, newspapers, and web sites. For me, the charm fades as I wear out the eraser before the pencil when the inevitable backtracking occurs. But they are an interesting software exercise.

Every cell in a 9x9 sudoku puzzle is a member of 3 intersecting sets - a 3x3 box, a 9-cell row, and a 9-cell column. For a pending change in any cell, the rule must be applied to each of these 3 sets. Ergo, most of the effort is in applying the constraints.

I discarded my first attempt which looked too much like a 'C' program. The current one stores the puzzle in a vector. There are lists of vector indices representing different views of the puzzle space. The entire puzzle can be validated using the for-each idiom for a list of lists.

The source text can be found on this Schemely Wiki page.

Thursday, February 23, 2006

What is Software?

Quoting What is Software? in the Google search widget gives 130,000 or more hits. Most append another word such as Design, Assurance, Piracy and so on. I found no satisfactory answer to the basic question.

I program embedded systems using 'C' with a bit of Java and Perl on the side. My job title says 'Software Designer' but my duties include poking bits and bytes into registers of custom hardware. This certainly is programming but is it really software design? We know that software requires programming but does it follow that programming results in something called software? If so, consider FPGAs and CPLDs found in modern embedded systems. They are programmed by an engineer using a description language. They effect system functions but are not software or the result of software design. So it seems that programming, or giving instructions to a machine does not always result in software.

I think that abstraction is the most important property of software. For example, Java has a virtual machine to separate the hardware and computer operating system from the application. It provides an abstraction boundary. An email client program can be made to run on any computer or OS while being designed with almost any scripting or compiled language. So an email client is software. Scheme, Lisp, Eiffel, and others have some form of Foreign Function Interface to support an abstraction boundary. C/C++ does not so more designer diligence is required to maintain a clean abstraction.

Jack Reeves at DeveloperDotStar came to an interesting conclusion.

* Ultimately, real advances in software development depend upon advances in programming techniques, which in turn mean advances in programming languages. C++ is such an advance. It has exploded in popularity because it is a mainstream programming language that directly supports better software design.
* C++ is a step in the right direction, but still more advances are needed.



Apparently, he was not aware of dynamic languages such as Scheme.

Thursday, January 19, 2006

Lispers looking fondly at Scheme



Planet Lisp has a favourable review of PLT Scheme by Bill Clementson.

Sunday, January 15, 2006

No Loop in Scheme


Today I learned that loop is not a keyword in Scheme. I assumed it was from my habit of copying snippets like
'(let loop .... ) from working programs without taking time to RTFM. Since Scheme is a dynamic language, obfuscated forms will work. For example, known names can be repurposed:-


;; testing letrec
(define (monkeys n)
(let letrec ( [x 3] )
(display "Monkey\n")
(if (> x 0)
(letrec (- x 1) ))))

(monkeys 0)
(exit)


Dorai Sitaram provides a clear example in section 6.2 of Teach Yourself Scheme.

Tuesday, January 10, 2006

sudoku puzzle investigation



Depth-First-search