Empty Function Example

Details

Action

A MathScript Function that tests whether a list is empty.

The following program reverses a list (as does the built-in reverse function):

Program Reversit (Li Lis) {

Local (Fn Reversit) (Li Mylis) {

If Empty(Lis) Then {Return Lis;} Else {

Let Mylis Be Reversit(Rest(Lis));

Append(Mylis,List(First(Lis)));

}

}

}