spade-0.1.0.1: docs/functions/list.md
### List Functions
#### insertleft
Inserts an element at the start of the list, and returns the modified
list.
Example:
```
let mylist = [2, 3]
let newlist = insertleft(10, mylist)
inspect(newlist) -- outputs : [10, 2, 3]
getkey()
```
#### insertright
Inserts an element at the end of the list, and returns the modified
list.
Example:
```
let mylist = [2, 3]
let newlist = insertright(mylist, 10)
inspect(newlist) -- outputs : [2, 3, 10]
getkey()
```
#### head
Gets the first item in the list.
Example:
```
let mylist = [2, 3]
inspect(head(mylist)) -- outputs : 2
getkey()
```
#### take
Returns another list made by taking the given number of items from the beginning of the list.
Example:
```
let mylist = [2, 3, 4, 5, 6]
inspect(take(mylist, 2)) -- outputs : [2, 3]
getkey()
```
#### drop
Returns another list made by dropping the given number of items from the beginning of the list.
Example:
```
let mylist = [2, 3, 4, 5, 6]
inspect(drop(mylist, 2)) -- outputs : [4, 5, 6]
getkey()
```
#### sum
Computes the sum of given items in the list.
Example:
```
let mylist = [2, 3, 4, 5, 6]
inspect(sum(mylist)) -- outputs : 20
getkey()
```
#### contains
Checks if the list contains a value.
Example:
```
let mylist = [2, 3, 4, 5, 6]
inspect(contains(mylist, 4)) -- outputs : true
inspect(contains(mylist, 40)) -- outputs : false
getkey()
```
#### filter
Calls the given callback on the items in the list, and remove those
for which the function returned false.
Example:
```
let mylist = [2, 3, 4, 5, 6]
inspect(filter(mylist, fn(x) mod(x, 2) == 0 endfn)) -- outputs [2, 4, 6]
getkey()
```
#### size
Returns the number of items in a list or a dictionary.
Example:
```
let mylist = [2, 3, 4, 5, 6]
inspect(size(mylist)) -- outputs : 5
getkey()
```