As Rich explained in one post, in Lisp-like languages, there is a certain amount of intertwining between two views of a sequence which is a series of linked nodes. One way is to think about these nodes as just nodes with a first and rest. Another way is to think about each node as representing an entire chain from this node onward to the end. He explained that next is more like the "move from one node to another" view, and rest is more like the view of these things as collections, where rest gives you the collection of everything but the first.
(rest []) translates in my mind to "everything but the first item of []". There is no first item of [], and there isn't an everything-but-the-first-item of it. It's empty. You can't take something out of it. In Scheme, Haskell, ML, etc., the rest of something empty would produce an error. In Clojure, which seems to be less inclined to produce error messages, I'd expect it to produce nil, in the sense of "this has no meaning or no answer" (not in the sense of nil as an empty-like entity). Coming from other functional languages, (rest ()) producing () seems bizarre to me. If you think of (rest sequence) as looking up some "rest" slot in sequence, '(1) has some sort of empty thing in the rest slot. In contrast, the empty sequence doesn't even have a rest slot (or if it does, you'd expect that it stores null/nil in it, rather than another empty sequence). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---