mirror of
https://github.com/antirez/aocla
synced 2024-12-26 09:58:42 +01:00
21 lines
385 B
Text
21 lines
385 B
Text
// Fundamental list manipulation functions. Part of the standard library.
|
|
// first, rest, cat
|
|
|
|
[
|
|
0 get@
|
|
] 'first def
|
|
|
|
[
|
|
#t (f) // True only for the first element
|
|
[] (n) // New list
|
|
[
|
|
[$f] [
|
|
#f (f) // Set flag to false
|
|
drop // Discard first element
|
|
] [
|
|
$n -> (n)
|
|
] ifelse
|
|
] foreach
|
|
$n
|
|
] 'rest def
|
|
|