Hacker News new | past | comments | ask | show | jobs | submit login
A short ballad dedicated to the growth of programs (1986) (ashwinram.org)
24 points by sph on Aug 5, 2023 | hide | past | favorite | 4 comments



I happened on this ballad by pure chance. I always disliked that in Common Lisp nil is equal to the empty list, then I spent last week playing with Guile Scheme. It could've been my favourite Lisp, if not for the constant annoyance of having to deal with the eventuality that car/cdr might return #f.

I'm now a convert. nil == '() is a great idea. People already sang about it in 1986.


It's not just the empty list being nil, but also that (car nil) -> nil.

Lisp had nil being the empty list from the beginning.

Scheme also had nil being the empty list, while it was still a project based on top of Lisp; then they fu^H^Hfchanged it.

What Lisp didn't have from the beginning was allowing (car nil) -> nil. According to Gabriel's History of Lisp HOPL paper, it was Interlisp which had this. Some sort of Great Lisp Summit event was held during which MacLisp people decided that it was a nice idea to allow (car nil) and (cdr nil). In turn, their big idea was programmable read tables, which Interlisp decided to adopt.

(cdr (assq key list)) depends on assq returning nil when the item is not found, and that being a valid value to pass to cdr. You could not make this work in Scheme if you have an assq that returns #f for "not found", unless you allow (cdr #f) -> #f. That starts to get absurd though, since #f is not related to lists.



Related:

A Short Ballad Dedicated to the Growth of Programs (1986) - https://news.ycombinator.com/item?id=18831265 - Jan 2019 (1 comment)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: