Search

Wednesday, November 15, 2006

Scheme of things

Programming in Static OO languages for a long time numbs the brain. These languages are designed to be simple and efficient. These criteria not necessary create beautiful languages. In the world of C++, C# our imagination get severely restricted.

Take for example the expression x + y. In scheme you can code this as

(define (addAbs x y)
((if (> y 0) + -) x y))

(addAbs 4 -5)

The if expression is very interesting. It actually compares y with 0 and returns a operator (+ or -). Its simply beautiful :)

No comments: