Hacker News new | ask | show | jobs
by bsder 2027 days ago
It's interesting, but here's the easiest way to evaluate if a Lisp/Scheme implementation article is interesting:

"Does it parse (2 . 3) vs (2 3) aka (2 3 . nil) correctly?"

That little dot which signifies a cons-pair makes implementing Lisp/Scheme oh-so-stupidly-much harder.

Suddenly your printing has to go all the way right before it can make decisions. Your recursions suddenly need to be robust against not being a list. etc.

3 comments

> evaluate if a Lisp/Scheme implementation article is interesting

I guess Clojure doesn't count as interesting and/or a lisp then, as `(2 . 3)` would not be parsed correctly and instead throw a syntax error on that form.

I still thought the article was interesting and would have loved to see a section on macros. Maybe next time.

> I guess Clojure doesn't count as interesting and/or a lisp then

The Schemers and Common Lispers have been saying this about Clojure for years, you know ...

And, in the interest of full disclosure, I don't disagree with the choice that Clojure made. Not being able to process a "list" as a sequence is a PITA.

However, articles like these get written with "Look how easy it is to make a Lisp" without saying "Except that we didn't implement these really hard features that actually make a Lisp"

Aren't cons cells just an implementation detail? I have no problem calling "lisp" any language where s-expressions are imlemented by any other tree/list data structure, and thus it doesn't have the dot.
I believe that lists are generally defined in the "Lisp" standards as a set of cons pairs terminated by nil.

This makes things a lot harder than they need to be--you effectively MUST process lists by recursion as you don't know you have a list until you hit that far right "nil".

Good point, they are actually specified so both in common lisp and scheme
"Lisp" in fact refers to a set of details for implementing a programming environment. The requirements are wobbly, but not so wobbly that you can call anything "Lisp".
Note that "correctly" means that (2 3 . nil) comes out as (2 3).