OpenMusic Reference
last-n
last-n
(lists module) -- returns the last n elements of a list
Syntax
last-n list n
Inputs
name | data type(s) | comments |
---|---|---|
list | a tree | |
n | a non-negative integer |
Output
output | data type(s) | comments |
---|---|---|
first | a tree |
Description
Returns the last n elements of the list . If n is longer than the length of list , the entire list is returned.
This function is identical to the LISP function last .
![]() |
last-n always returns a list even if asked to return just one element. To isolate the last element of a list as an atom, use last-elem .
—|—
Prev | Home | Next |
---|---|---|
last-elem | Up | length |