WAL Programmer Manual

0.8.2

5. Lists

This section describes list functions.
(list expr*) ↦ (list?)
    expr : WAL expression
Returns a list whose elements are the evaluated expressions in the order they were passed to the function.
(first xs)
(second xs)
(last xs)
      xs : (list?)
Returns the first, second, or last element of list xs.
(rest xs)
      xs : (list?)
Returns a list containing all but the first element of xs.
(in x xs)
        x : WAL Expression
       xs : (list?)
Returns true if x is an element in xs.
(min xs)
(max xs)
       xs : (list?)
Returns the smallest or largest element in xs.
(sum xs)
       xs : (list?)
Returns the sum of all elements in xs.
(average xs)
       xs : (list?)
Returns the average of all elements in xs.
(length xs)
       xs : (list?)
Returns the number of elements in xs.
(map f xs)
        f : Function (fn [x] ...)
       xs : (list?)
Returns a list containing (f x) for each x in xs in the order they appear in xs.