mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 11:56:54 +03:00
10 lines
192 B
Plaintext
10 lines
192 B
Plaintext
Take_ n list =
|
|
switch _ = (== n 0) {
|
|
| 0: (Take n list)
|
|
| _: []
|
|
}
|
|
Take n (List/Nil) = []
|
|
Take n (List/Cons x xs) = (List/Cons x (Take_ (- n 1) xs))
|
|
|
|
main = (Take 2 [3, 2, 1, 5, 5, 5])
|