summaryrefslogtreecommitdiff
path: root/tigrou/linked-list/linked-list.tig
blob: 04c8a296370074291b08771c5e4dbaef6e19d9da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
let
  import "linked-list.tih"
  var list := node { value = 0, next = nil }

  function test_lists(expected: string) =
    (
      print(concat("Expected : { ", expected));
      print(" }\ngot      : { ");
      display(list);
      print(" }\n\n")
    )
in
  test_lists("0");

  print("Adding '1' ...\n");
  append(list, 1);

  test_lists("0 -> 1");

  print("Adding '2' ...\n");
  append(list, 2);

  test_lists("0 -> 1 -> 2")
end