Rest Function Example

Details

Action

A MathScript Function that returns a list of elements after the first element of a list. If the list has just one element, returns the empty list. If the list is empty, returns an error.

make l1 list(3,1)

rest
(l1)

returns the list (1). This is a MathScript list, not a number.

If l1 is the result of a textlist command that read the contents of a text field named "coord", then it is necessary to use the first command to get the number 1 from the list. The complete script to get the coordinates is

let l1 value textlist("coord");

let xvalue first(l1);

let yvalue first(rest(l1));