pub type intlist { pub [] | [|](head:int, tail:intlist) }
pub def list_print(x:intlist) use !io {
if { x = [ ?h | ?t] ::
!print(h)
!print(" ")
!list_print(t)
}
}
pub def list_println(x:intlist) use !io {
!list_print(x)
!println("")
}
?x = [1,2,3,4,5,6]
?y = [999]
!list_println(x)
!list_println(y)
if { x = [ ?h | ?t] ::
if { tail(!t, y) ::
!print("t: ")
!list_println(t)
}
}
!list_println(x)
*main* > public (0 calls)
0: (argc#0:wybe.int, [?argc#0:wybe.int], argv#0:wybe.int, [?argv#0:wybe.int], exit_code#0:wybe.int, [?exit_code#0:wybe.int], io#0:wybe.phantom, ?io#5:wybe.phantom): AliasPairs: []
foreign lpvm alloc(16:wybe.int, ?tmp$13#0:error_case.intlist)
foreign lpvm mutate(~tmp$13#0:error_case.intlist, ?tmp$14#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 6:wybe.int)
foreign lpvm mutate(~tmp$14#0:error_case.intlist, ?tmp$15#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 0:error_case.intlist)
foreign lpvm alloc(16:wybe.int, ?tmp$18#0:error_case.intlist)
foreign lpvm mutate(~tmp$18#0:error_case.intlist, ?tmp$19#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 5:wybe.int)
foreign lpvm mutate(~tmp$19#0:error_case.intlist, ?tmp$20#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~tmp$15#0:error_case.intlist)
foreign lpvm alloc(16:wybe.int, ?tmp$23#0:error_case.intlist)
foreign lpvm mutate(~tmp$23#0:error_case.intlist, ?tmp$24#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 4:wybe.int)
foreign lpvm mutate(~tmp$24#0:error_case.intlist, ?tmp$25#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~tmp$20#0:error_case.intlist)
foreign lpvm alloc(16:wybe.int, ?tmp$28#0:error_case.intlist)
foreign lpvm mutate(~tmp$28#0:error_case.intlist, ?tmp$29#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 3:wybe.int)
foreign lpvm mutate(~tmp$29#0:error_case.intlist, ?tmp$30#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~tmp$25#0:error_case.intlist)
foreign lpvm alloc(16:wybe.int, ?tmp$33#0:error_case.intlist)
foreign lpvm mutate(~tmp$33#0:error_case.intlist, ?tmp$34#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 2:wybe.int)
foreign lpvm mutate(~tmp$34#0:error_case.intlist, ?tmp$35#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~tmp$30#0:error_case.intlist)
foreign lpvm alloc(16:wybe.int, ?tmp$38#0:error_case.intlist)
foreign lpvm mutate(~tmp$38#0:error_case.intlist, ?tmp$39#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 1:wybe.int)
foreign lpvm mutate(~tmp$39#0:error_case.intlist, ?tmp$40#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, tmp$35#0:error_case.intlist)
foreign lpvm alloc(16:wybe.int, ?tmp$43#0:error_case.intlist)
foreign lpvm mutate(~tmp$43#0:error_case.intlist, ?tmp$44#0:error_case.intlist, 0:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 999:wybe.int)
foreign lpvm mutate(~tmp$44#0:error_case.intlist, ?tmp$45#0:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, 0:error_case.intlist)
error_case.list_print<0>(tmp$40#0:error_case.intlist, ~#io#0:wybe.phantom, ?tmp$48#0:wybe.phantom) @error_case:12:6
foreign c print_string("":wybe.string, ~tmp$48#0:wybe.phantom, ?tmp$49#0:wybe.phantom) @wybe:100:39
foreign c putchar('\n':wybe.char, ~tmp$49#0:wybe.phantom, ?#io#1:wybe.phantom) @wybe:86:26
error_case.list_print<0>(tmp$45#0:error_case.intlist, ~#io#1:wybe.phantom, ?tmp$52#0:wybe.phantom) @error_case:12:6
foreign c print_string("":wybe.string, ~tmp$52#0:wybe.phantom, ?tmp$53#0:wybe.phantom) @wybe:100:39
foreign c putchar('\n':wybe.char, ~tmp$53#0:wybe.phantom, ?#io#2:wybe.phantom) @wybe:86:26
foreign llvm icmp ne(tmp$40#0:error_case.intlist, 0:wybe.int, ?tmp$55#0:wybe.bool)
case ~tmp$55#0:wybe.bool of
0:
error_case.list_print<0>(~tmp$40#0:error_case.intlist, ~#io#2:wybe.phantom, ?tmp$58#0:wybe.phantom) @error_case:12:6
foreign c print_string("":wybe.string, ~tmp$58#0:wybe.phantom, ?tmp$59#0:wybe.phantom) @wybe:100:39
foreign c putchar('\n':wybe.char, ~tmp$59#0:wybe.phantom, ?#io#5:wybe.phantom) @wybe:86:26
1:
foreign llvm move(~tmp$35#0:error_case.intlist, ?t#0:error_case.intlist)
foreign llvm icmp ne(%t#0:error_case.intlist, 0:wybe.int, ?tmp$58#0:wybe.bool)
case ~tmp$58#0:wybe.bool of
0:
foreign llvm move(~%t#0:error_case.intlist, ?%t#1:error_case.intlist)
error_case.list_print<0>(~tmp$40#0:error_case.intlist, ~#io#2:wybe.phantom, ?tmp$61#0:wybe.phantom) @error_case:12:6
foreign c print_string("":wybe.string, ~tmp$61#0:wybe.phantom, ?tmp$62#0:wybe.phantom) @wybe:100:39
foreign c putchar('\n':wybe.char, ~tmp$62#0:wybe.phantom, ?#io#5:wybe.phantom) @wybe:86:26
1:
# !!!! It should be non-destructive here.
foreign lpvm mutate noalias(~%t#0:error_case.intlist, ?%t#1:error_case.intlist, 8:wybe.int, 1:wybe.int, 16:wybe.int, 0:wybe.int, ~tmp$45#0:error_case.intlist)
foreign c print_string("t: ":wybe.string, ~#io#2:wybe.phantom, ?#io#3:wybe.phantom) @wybe:100:39
error_case.list_print<0>(~t#1:error_case.intlist, ~#io#3:wybe.phantom, ?tmp$63#0:wybe.phantom) @error_case:12:6
foreign c print_string("":wybe.string, ~tmp$63#0:wybe.phantom, ?tmp$64#0:wybe.phantom) @wybe:100:39
foreign c putchar('\n':wybe.char, ~tmp$64#0:wybe.phantom, ?#io#4:wybe.phantom) @wybe:86:26
error_case.list_print<0>(~tmp$40#0:error_case.intlist, ~#io#4:wybe.phantom, ?tmp$67#0:wybe.phantom) @error_case:12:6
foreign c print_string("":wybe.string, ~tmp$67#0:wybe.phantom, ?tmp$68#0:wybe.phantom) @wybe:100:39
foreign c putchar('\n':wybe.char, ~tmp$68#0:wybe.phantom, ?#io#5:wybe.phantom) @wybe:86:26