>
> The reason that 'plus (f,g) == x+->f(x)+g(x)' fails in interpreter may
> have nothing to do with type system, but because of interpreter can
> not handle closure:
>
> For example, the 'adder' function:
> adder x == y +-> y + x
>
> It totally works in Spad form, but in interpreter:
>
> (2) -> q := adder 3
> Compiling function adder with type PositiveInteger ->
> AnonymousFunction
>
> (2) y +-> y + #1
> Type: AnonymousFunction
> (3) -> q 4
>
> (3) #1 + 4
> Type: Polynomial(Integer)
>
> The '#1' should be the captured value of 'x', thus 3.
>
> So, interpreter can not handle captured variable, aka closure,
> this is a bug, am I right?
Yes this is a bug. There are problems with closures in interpreter.
For many purposes they work OK, but there are problems with higher
order functions.
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.