aocla/examples/firstrest.aocla

22 lines
385 B
Text
Raw Normal View History

2023-01-30 11:45:55 +01:00
// 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