realize


realize(n, s)
      

Return a pair with the first n elements of the sequence s in its head and the rest of s in its tail.

Examples:


realize(3, [1, 2, 3, 4, 5])
// [[1, 2, 3], 4, 5]

function ints(n) n:~ints(n+1)
let xs = ints(10)
realize(5, xs)
// [10, 11, 12, 13, 14]:15:<promise>
realize(3, tail(realize(5, xs)))
// [15, 16, 17]:18:<promise>
      

Also see:

nth
accumulate


Core Module Index | Contents