The most common way to create a list is with the list function e.g.
(list 1 2 3 4) --> (1 2 3 4)
| method name | description |
|---|---|
| length | return the no. of items in the list |
| head | return the first item in the list |
| tail | return a list of all items excluding the first in the supplied list |
| cons | construct a list by creating a new one with the supplied head and tail |
| endCons | surgically update this list by adding the supplied element on the end |
| reverse | create a new list which is the reverse of this one |
| get | get the nth item from the list (the first has index = 0) |
| set | get the nth item from the list (the first has index = 0) -- this surgically updates the list |
| member | search this list for the supplied item, returning its zero-based index if found |
| find | treating the list as a list of attribute/value pairs, find the value for the given attribute |
| findAux | treating the list as a list of attribute/value(s) entries, find the values for the given attribute |
| replaceHead | surgically replace the head of this list with the supplied object |
| replaceTail | surgically replace the tail of this list with the supplied list |
| string | create a string representation of this list |
Return the no. of items in the list.
Arguments: none
Return type: Integer
Return the first item in the list. An error is thrown if attempt to take the head of an empty list.
Arguments: none
Return type: Object
Return a list of all items excluding the first in the supplied list.
Arguments: none
Return type: List
Construct a list by creating a new one with the supplied head and tail.
Arguments:
| newHead | Object |
Return type: List
Surgically update this list by adding the supplied element on the end.
Arguments:
| item | Object |
Return type: the empty List ()
Return a list which is the reverse of this list.
Arguments: none
Return type: List
Get the nth item from the list (the first has index = 0).
Arguments:
| idx | Integer |
Return type: Object
Set the nth item from the list (the first has index = 0). This surgically updates the list
Arguments:
| idx | Integer |
| newValue | Object |
Return type: the empty List ()
is returned.
Search this list for the supplied item, returning its zero-based index if found.
Arguments:
| item | Object |
Return type: Integer or
the empty List ()
Treating the list as a list of attribute/value pairs, find the value for the given attribute.
Arguments:
| attrib | Object |
Return type: Object
Treating the list as a list of attribute/value(s) entries, find the values for the given attribute.
Arguments:
| attrib | Object |
Return type: Object
Surgically replace the head of this list with the supplied object.
Arguments:
| newHead | Object |
Return type: the empty List
Surgically replace the tail of this list with the supplied list.
Arguments:
| newTail | List |
Return type: the empty List
Create a string representation of this list.
Arguments: none
Return type: String
| Contents | Index | Current topic: objects | Related links: builtin objects |