HVM
HVM copied to clipboard
Main result doesn't get fully expanded if a top-level variable is in list
Reproducing the behavior
Running command hvm run out.hvm
With code (Bend)
add = (@a @b (+ a b))
x = (add 1 1)
main = [(x),(x)]
With code (HVM)
@List/Cons = (a (b ((@List/Cons/tag (a (b c))) c)))
@List/Cons/tag = 1
@List/Nil = ((@List/Nil/tag a) a)
@List/Nil/tag = 0
@add = ($([+] $(a b)) (a b))
@main = b
& @List/Cons ~ (@x (a b))
& @List/Cons ~ (@x (@List/Nil a))
@x = a
& @add ~ (1 (1 a))
Error:
- Returns
[x, x](if ran viabend run) - or
((@List/Cons/tag (@x (((@List/Cons/tag (@x (@List/Nil v5))) v5) va))) va)(if ran viahvm run)
Expected behavior:
- Returns
[2, 2](if ran viabend run) - or
((@List/Cons/tag (2 (((@List/Cons/tag (2 (@List/Nil v10))) v10) v1e))) v1e)(if ran viahvm run)
Note: When you instead use
add = (@a @b (+ a b))
x * = (add 1 1)
main = [(x *),(x *)]
everything is fine (as in the expected block above)
System Settings
OS: Windows WSL2 / macOS CPU: AMD Ryzen 7 5800X3D / Apple M1 Pro GPU: not used in this example Cuda Version: not used in this example
Additional context
No response