HVM icon indicating copy to clipboard operation
HVM copied to clipboard

Main result doesn't get fully expanded if a top-level variable is in list

Open Janiczek opened this issue 1 year ago • 0 comments

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 via bend run)
  • or ((@List/Cons/tag (@x (((@List/Cons/tag (@x (@List/Nil v5))) v5) va))) va) (if ran via hvm run)

Expected behavior:

  • Returns [2, 2] (if ran via bend run)
  • or ((@List/Cons/tag (2 (((@List/Cons/tag (2 (@List/Nil v10))) v10) v1e))) v1e) (if ran via hvm 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

Janiczek avatar Jun 08 '24 16:06 Janiczek