Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
def new($item; $next):
|
||||
if $next | (.==null or is_singly_linked_list)
|
||||
then {$item, $next}
|
||||
else "new(_;_) called with invalid SLL: \($next)" | error
|
||||
end;
|
||||
|
||||
# A constructor:
|
||||
def new($x): new($x; null);
|
||||
|
||||
def insert($x):
|
||||
if is_empty_singly_linked_list then {item: $x, next: null}
|
||||
else .next |= new($x; .)
|
||||
end;
|
||||
|
|
@ -0,0 +1 @@
|
|||
new(1) | insert(2)
|
||||
Loading…
Add table
Add a link
Reference in a new issue