Carapace

List Handling

function name description
cons construct a list by creating a new one with the supplied head and tail
headOf return the first item in the list
tailOf return a list of all items excluding the first in the supplied list
list create a list out of the arguments


cons

Construct a list by creating a new one with the supplied head and tail.

Arguments:

newHeadObject
newTailList

Return type: List

Examples:

    (cons 1 (list 1 2 3)) --> (1 2 3 4)

headOf

Return the first item in the list. An error is thrown if attempt to take the head of an empty list.

Arguments:

listList

Return type: Object

Examples:

    (headOf (list 1 2 3)) --> 1

tailOf

Return a list of all items excluding the first in the supplied list.

Arguments:

listList

Return type: List

Examples:

    (headOf (list 1 2 3)) --> (2 3)

list

Create a list out of the arguments.

Arguments:

Multiple arguments which can be of any type.

Return type: List

Examples:

    (list 1 2 3 "four" (quote five) 0x"06") --> (1 2 3 "four" five 0x"06")


Contents Index Current topic: functions Related topics: objects