level: Functional lists
Questions and Answers List
level questions: Functional lists
Question | Answer |
---|---|
Whats the head defined as | First item in a list |
Whats the tail defined as | The rest of the list without the head |
Code how to reutnr the head of a list [1,2,3,4,5] | head [1,2,3,4,5] |
Code how to reutnr the tail of a list [1,2,3,4,5] | tail [1,2,3,4,5] |
Check wether a list called myList is empty | null myList |
Code how to check the length of a list | length mylist OR length [1,2,3,4,5] |
Where does list indexing start for functional programming | 1 |
How do you create a list in functional programming | let List = [] |
Write how to prepend an item to a list | let setA = [1,2,3,4] let setB = [0] ++ setA |
Append an item to a list | let setA = [1,2,3,4] let setB = setA ++ [0] |