mirror of
https://github.com/anoma/juvix.git
synced 2024-12-12 14:28:08 +03:00
3fbc9c7c55
Closes #1644 #1635
67 lines
745 B
Plaintext
67 lines
745 B
Plaintext
-- structural equality
|
|
|
|
type list {
|
|
nil : list;
|
|
cons : * -> list -> list;
|
|
}
|
|
|
|
function main() {
|
|
push 1;
|
|
push 1;
|
|
eq;
|
|
trace; -- true
|
|
pop;
|
|
push 1;
|
|
push 0;
|
|
eq;
|
|
trace; -- false
|
|
pop;
|
|
alloc nil;
|
|
alloc nil;
|
|
eq;
|
|
trace; -- true
|
|
pop;
|
|
alloc nil;
|
|
alloc nil;
|
|
push 1;
|
|
alloc cons;
|
|
eq;
|
|
trace; -- false
|
|
pop;
|
|
alloc nil;
|
|
push 2;
|
|
alloc cons;
|
|
alloc nil;
|
|
push 1;
|
|
alloc cons;
|
|
eq;
|
|
trace; -- false
|
|
pop;
|
|
alloc nil;
|
|
push 2;
|
|
alloc cons;
|
|
push 1;
|
|
alloc cons;
|
|
alloc nil;
|
|
push 1;
|
|
alloc cons;
|
|
eq;
|
|
trace; -- false
|
|
pop;
|
|
alloc nil;
|
|
push 2;
|
|
alloc cons;
|
|
push 1;
|
|
alloc cons;
|
|
alloc nil;
|
|
push 2;
|
|
alloc cons;
|
|
push 1;
|
|
alloc cons;
|
|
eq;
|
|
trace; -- true
|
|
pop;
|
|
push void;
|
|
ret;
|
|
}
|