diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tigrou/linked-list/linked-list.tih | |
Diffstat (limited to 'tigrou/linked-list/linked-list.tih')
| -rw-r--r-- | tigrou/linked-list/linked-list.tih | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tigrou/linked-list/linked-list.tih b/tigrou/linked-list/linked-list.tih new file mode 100644 index 0000000..b890f3a --- /dev/null +++ b/tigrou/linked-list/linked-list.tih @@ -0,0 +1,15 @@ +type node = {value : int, next : node} +function append(list: node, element: int) = + if list.next = nil then + list.next := node{value = element, next = nil} + else + append(list.next, element) + +function display(list: node) = + if list <> nil then + ( + print_int(list.value); + (if list.next <> nil then + print(" -> ")); + display(list.next) + ) |
