take(n, xs)
Return a new list with the first n
elements from the sequence xs
.
take(3, [1, 2, 3, 4, 5])
// [1, 2, 3]
take(30, [1, 2, 3, 4, 5])
// [1, 2, 3, 4, 5]
take(0, [1, 2, 3, 4, 5])
// []
take(-3, [1, 2, 3, 4, 5])
// []
function ints(n) n:~ints(n+1)
let s = ints(10)
take(10, s)
// [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]