Hi,

Am 28.02.2009 um 04:14 schrieb Mark Engelberg:

I expect:
(rest [1]) -> ()
(rest []) -> nil

Just as (first []) yields nil, so should (rest []), IMO.

The definition of rest, is that it returns a collection
of items of the rest of the given seqable thing.

first is a different case. It takes a seqable thing and
returns a thing or nothing. If the given collection is
empty (or it is given nil as a "sequence"), there is no
first thing. Hence first returns nothing (nil).

next is again different. It takes a seqable thing, and
returns a sequence of the remaining items in the
sequence without the first one or nothing if there are
no more items (or there were none to begin with).

rest is now a special view on the return value of
next. It always returns a collection of the remaining
items. If there are none, ie. next returned nil, this
is the empty list, which is the concrete collection
containing no items corresponding to an "empty
sequence".

So far everything seems consistent to me. rest is
really just a different view of next. One can be
considered the abstract concept, while the other
is a concrete thing.

Sincerely
Meikel

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to