Hacker News new | ask | show | jobs
by TeMPOraL 3626 days ago
Multiple return values are a great idea IMO, and I learned to really appreciate them in Common Lisp. They're best used as additional bits of information that the programmer may or may not find useful. Like that string comparison example of yours. Or #'gethash[0], that will return the value from hash table you're looking for or a default value (which is optional and by default NIL) if there is no entry with a given key, but it'll also return a second, boolean value that tells you whether your return value was actually found or not - which cleanly solves the problem of storing NILs in hash tables, in the places you care about it.

Multiple return values feel elegant also because the compiler can optimize them away when you're not using them, which is the most common case.

[0] - http://clhs.lisp.se/Body/f_gethas.htm