take

take(v,n) -- yields a list containing the first n elements of the list v.
take(v,-n) -- yields a list containing the last n elements of the list v.
take(v,{m,n}) -- yields a list containing the elements of the list v in positions m through n.

i1 : take({a,b,c,d,e,f},3)

o1 = {a, b, c}

o1 : List
i2 : take({a,b,c,d,e,f},-3)

o2 = {d, e, f}

o2 : List
i3 : take({a,b,c,d,e,f},{2,4})

o3 = {c, d, e}

o3 : List

See also drop.


topindexpreviousupnext