Here's a couple small REBOL puzzles for those of you who enjoy that
kind of thing:
1. Can you simulate a static local variable in REBOL? The variable
should be local to a function, but each time the function is called,
the variable has the same value it had at the end of the last function
call. The variable should be modified in some way in the function
(incremented for instance) and it should have the modified value on
subsequent calls. I have one solution, but I think there could be
others.
2. Can you create a line of REBOL code, including two or more
functions of arity one or more (that take one or more parameters),
that results in the same result forwards or backwards? To verify, put
the code in a block, and try:
(do block) = do reverse block
And it's no fair padding either side of the block! ie:
[1 1 print 1 print 1 1]
(Okay that one's convoluted...)
3. Can you make a function which takes one argument, unless called
with a refinement in which case the function takes no arguments?
4. Can you create a parse rule that recognizes whether a string of
numbers is from the Fibonacci sequence?
5. Can you think up more puzzles?
:-)
-jeff