nth


nth(n, s)
      

Return the element at index n of the sequence s. If s is not a valid sequence or if n is not a valid index, return false.

Examples:


nth(3, [1, 2, 3, 4, 5])
// 4
          
function ints(n) n:~ints(n + 2) // an infinite sequence of integers
let s = ints(10)

nth(0, s)
// 10
nth(100, s)
// 210          
      

Also see:

first
rest
head
tail
nth_tail
count


Core Module Index | Contents