Singly-linked list/Traversal
var list = 'a':'b':'c':nil
#var list = ['a', ['b', ['c']]]
#var list = Pair('a', Pair('b', Pair('c', nil)))
for (var l = list; l != nil; l = l[1]) {
say l[0]
}
Output:
a
b
c
var list = 'a':'b':'c':nil
#var list = ['a', ['b', ['c']]]
#var list = Pair('a', Pair('b', Pair('c', nil)))
for (var l = list; l != nil; l = l[1]) {
say l[0]
}
a
b
c