You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm extremely new to Scheme, so it's possible this is a silly mistake on my end, but I'm having an issue that works in the general case but not inside of a lambda-shape:
(lambda-shape (x y z) (if (> x 0) x 0) )
gives an error that says
wrong-type-arg: Wrong type: #<<tree> 139e64140>
Stack trace:
0: (lambda-shape (x y z) (if (> x 0) x 0))
even though (let ((x 1)) (if (> x 0) x 0) )
works fine, so it isn't some kind of syntax thing; it seems like for some operations, the x y z arguments aren't treated like numbers? (even though for functions like + it works fine...)
The text was updated successfully, but these errors were encountered:
lambda-shape isn't powerful enough to evaluate arbitrary Scheme code; it's intended to JIT a (basically) arithmetic expression. In this case, the issue is that lambda-shape doesn't accept conditionals, since the branches are evaluated lazily rather than eagerly.
There's a little more theory about the JITting here.
In this case, you can use (lambda-shape (x y z) (max x 0)) as an alternative.
In general, the functions that lambda-shape will accept are defined in ao-guile.cpphere.
I'm extremely new to Scheme, so it's possible this is a silly mistake on my end, but I'm having an issue that works in the general case but not inside of a lambda-shape:
(lambda-shape (x y z) (if (> x 0) x 0) )
gives an error that says
even though
(let ((x 1)) (if (> x 0) x 0) )
works fine, so it isn't some kind of syntax thing; it seems like for some operations, the
x y z
arguments aren't treated like numbers? (even though for functions like+
it works fine...)The text was updated successfully, but these errors were encountered: