Re:Ask HN: I want to start learning Lisp. Where do I begin?
by coold on Wednesday December 16, 2020 @10:03AM
(#25443350)
Can I read SICP while learning Clojure? Is lisp very different?
[ Parent
| on HN ]
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by db48x on Wednesday December 16, 2020 @10:49AM
(#25443972)
I wouldn't, unless you already know Scheme well. Otherwise, you're essentially learning two programming languages at once, and you won't know if your mistakes are because you misunderstand Scheme, Clojure, or both.
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by toby on Wednesday December 16, 2020 @10:47AM
(#25443951)
There are a few people who have translated the solutions to Clojure, this one looks like the most comprehensive:
http://www.sicpdistilled.com/
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by WillPostForFood on Wednesday December 16, 2020 @11:10AM
(#25444229)
It looks like only chapter 1 is completed. A lot of chapter 2, and the just bits of 3 and 4.
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by zelphirkalt on Wednesday December 16, 2020 @11:36AM
(#25444575)
Not sure Clojure can do all the recursion stuff (TCO), which would be good to have in a language, when working through SICP exercises. I would not recommend it for SICP. Better start with a Scheme, to have the least amount of friction.
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by fulafel on Thursday December 17, 2020 @01:05AM
(#25453059)
You can trivially use recur for self-recursion: call (recur x) instead of (my-fn x) inside your function.
(There's also trampoline for mutual recursion cases)
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by zelphirkalt on Thursday December 17, 2020 @04:14AM
(#25453935)
Is trampolining automatic, or does it have its own syntax as well?
Even a little thing like (recur ...) could be a tiny amount of friction. But good to read, that the usual cases are apparently handled well in the language.
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by fulafel on Thursday December 17, 2020 @11:25AM
(#25457009)
The builtin helper function is called trampoline, it's a higher order function that relies on the mutually recursive functions returning "trampolines" or closures that do the desired subsequent call.
The trampoline pattern is an old trick that can also be imlemented in other languages to avoid stack consumption in mutually recursive calls.
Re:Ask HN: I want to start learning Lisp. Where do I begin?
by zelphirkalt on Friday December 18, 2020 @08:03PM
(#25473983)
I know what trampolining does, thank you.
That's unfortunate, that it is an additional function call, which needs to be explicitly written out. I'd guess such is necessary ultimately, because of limitations of the JVM and its limitations regarding recursion.