News for hackers. Stuff that matters.
Re:Why SICP Matters by webreac on Tuesday April 30, 2013 @10:46AM (#5632447)
Which one is obscure ? define factorial (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1))))))

let rec fact = function | 0 -> 1 | n -> n * fact (n - 1);;

There is a little more syntax to learn in caml, but the suppression of 90% of the parenthesis makes the code far easier to read.

Re:Why SICP Matters by gnosis on Tuesday April 30, 2013 @11:26AM (#5632685)
With syntax hilighting and proper indenting, the Scheme code is pretty easy to read:

http://img1.imagilive.com/0413/scheme-fact.png

You could even simplify it a little by getting rid of the lambda:

http://img1.imagilive.com/0413/scheme-fact2.png

In any case, I find toy examples like this less than convincing. In real-world programs, issues of style, design, and documentation usually trump most anything else, as far as clarity is concerned.

Also, I personally find the penchant for one-letter variable names in the OCaml/SML/Haskell world to be very confusing and obfuscating.

The Scheme way is to be more verbose and explicit. For me, that results in much greater clarity -- especially when looking at unfamiliar code or code that you've stepped away from for a few months.

Of course, there also such a thing as being too verbose and explicit. But for me, Scheme is in the sweet spot between verbosity and terseness.

Re:Why SICP Matters by eru on Tuesday April 30, 2013 @02:38PM (#5634045)
E.g. Haskell has enough syntactic sugar for some an even simpler version

    factorial n = product [1..n]
Re:Why SICP Matters by minikomi on Wednesday May 01, 2013 @01:27AM (#5636605)
Something similar is achievable in scheme, just takes a little work http://repl.it/InA (click run session) :)
Re:Why SICP Matters by eru on Wednesday May 01, 2013 @07:18AM (#5637307)
Oh, you don't even need macros for something similar. E.g. Python's range function works just fine.
Re:Why SICP Matters by davexunit on Tuesday April 30, 2013 @01:11PM (#5633462)
I find the lisp easier to read.