As a Factor newcomer, I'm having some difficulty figuring out how to express
myself idiomatically.
Here's an example, my first crack at a word to return the sum of a sequence
of numbers on the stack.
USING: kernel assocs namespaces math sequences prettyprint ;
IN: mayson
SYMBOL: mysum
: sequence-sum ( seq -- sum )
0 mysum set
mysum get [ + mysum set ] curry each mysum get ;
It seems to work, but two things look wrong to me: the (semi-)global
variable, and the necessity of using a curry.
Are there any reasonably Factorial ways to clean this up?
Mayson
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk