Elan said:
I think Jeff's example (subject: [REBOL] Functional
programming in REBOL Re:):
use [pod][
do pod: func [x][
any [all [zero? x 1]
all [odd? x x * pod x - 1] pod x - 1]
] 20
]
which, when executed evaluates to:
== 654729075
actually demonstrates that "it is possible to write mostly
functional code that can handle reasonable amounts of data".
Obviously this begs the question of what is a `reasonable'
amount of data. Jeff's code calls itself recursively 20 times.
REBOL seems to limit the stack to about 1000 recursive calls.
The product of the first 1000 odd integers is too large to represent
in REBOL anyway.
However, let's finesse the integer overflow problem.
Suppose we modify Jeff's code to compute the SUM of the
first 2000 odd integers (replace the `*' with `+' and the `20'
with `2000'). REBOL gets a stack overflow, yet the obvious
`imperative' version of the program produces the correct answer.
If you consider a data set of `dozens' or `hundreds' of elements
to be the limits of `reasonable', then, yes, REBOL does just fine.
I routinely use datasets of `thousands' or `millions' of elements,
and I occasionally stray into `billions' of elements, all of
which are well beyond the limits of REBOL's capacity
as a functional language, but not as an imperative language.
John
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com