I was writing Spad code for
http://rosettacode.org/wiki/Closures/Variable_capture and noticed that perhaps
anonymous functions cannot have zero arguments in Spad. For code:
)abbrev package TESTP TestPackage
TestPackage() : with
test: () -> List((()->Integer))
==
add
test() ==
[(i^2)@(()->Integer) for i in 1..10]
--[(() +-> i^2)@(()->Integer) for i in 1..10]
The zero argument version (commented out) does not work.
Zero argument anonymous functions do work in the interpreter, however closures
do not work in the interpreter.
It is a toy example, so perhaps zero argument anonymous functions in Spad are
not important (actually, I was surprised that the trick using the compiler hint
worked). Any suggestions or advice?
Kindly, Mark.
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.