rest(s)
Return all elements except the first one from the sequence s
. If s
is not a valid sequence, return
false
.
Rest
is a generic function recognized by the language. A user-defined object can respond to the
'rest
message and start behaving like a sequence. (See the documentation on
first
for an example).
rest([1, 2, 3, 4, 5])
// [2, 3, 4, 5]
function ints(n) n:~ints(n + 1) // an infinite sequence of integers
let s = ints(0)
first(s)
// 0
first(rest(s))
// 1