Algorithms List and Tuple Quick Reference
Algorithms List and Tuple Quick Reference
A quick reference for list and tuple operators used in the algorithms.
LIST OPERATIONS
[] an empty list
3 2 1 [] a three element list
[3, 2, 1] a list in shorthand notation
[] is empty = true
[1] is empty = false
[ 1] =1 []
1 = head [1] = head 1 []
[] = tail [1] = tail 1 []
a ← head [3, 2, 1] a ← 3;
b ← tail [3, 2, 1] b ← [2, 1];
a b c ← [3, 2, 1] a ← 3; b ← 2; c ← [1];
a b c ← 3 2 1 [] a ← 3; b ← 2; c ← [1];
a c ← [3, 2, 1] a ← 3; c ← [1];
a c ← 3 2 1 [] a ← 3; c ← [1];
TUPLE OPERATIONS