var p=Pair(42,99)say p.first#=> 42say p.second#=> 99p.first="foo"# change first elementp.second="bar"# change second elementsay p#=> Pair("foo", "bar")
Linked lists can be created using nested Pair objects:
var ll =Pair(1,Pair(2,Pair(3,4)))loop { say ll.firstif (ll.second.kind_of(Pair)) { ll = ll.second }else { say "Reached end: #{ll.second}"break }}