Ralf: thank you. Apologies: I was using an old version of Fricas (1.0.9) compiled for Windows (mingw).
The code is now here: http://rosettacode.org/wiki/Closures/Variable_capture#Axiom. Kindly, Mark. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Ralf Hemmecke Sent: Wednesday, 22 February 2012 11:17 AM To: [email protected] Subject: Re: [fricas-devel] Anonymous function with zero arguments in Spad Can you please post your error message. ---rhxBEGIN anonfun.spad ------------------------------- )abbrev package MYTESTP MyTestPackage AnonFun==>()->Integer L==>List(AnonFun) MyTestPackage() : with mytest: () -> L == add mytest(): L == [(() +-> i^2)@AnonFun for i in 1..10] )abbrev package TESTP TestPackage TestPackage() : with test: () -> List((()->Integer)) == add test() == [(() +-> i^2)@(()->Integer) for i in 1..10] ----------------------------------------------------------- (1) -> )compile > 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? anonfun.spad <snip> (2) -> [x() for x in test()] (2) [1,4,9,16,25,36,49,64,81,100] Type: List(Integer) (3) -> [x() for x in mytest()] (3) [1,4,9,16,25,36,49,64,81,100] Type: List(Integer) Where is the problem? Ralf -- 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. -- 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.
