[REBOL] Re: Confusion on when a block gets evaluated
From: tim-johnsons:web at: 6-Mar-2006 17:07
* Peter Wood <pwawood-gmail.com> [060305 21:34]:
> Jeff
>
> Ladislav Mecir's excellent "essays" may help, particularly
> http://en.wikibooks.org/wiki/REBOL_Programming/Advanced/Interpreter
>
> You can access Ladislav's other work via
> http://www.fm.vslib.cz/~ladislav/rebol/
You can also use the rebol word
unset?
which is a predicate that checks to see if a value
is unset.
example:
>> unset? print "yes"
yes
== true
This is useful when using a loop to accumulate values. You can use to
first check to see something is unset before adding it to whatever you
are using to accumulate the values.
I generally use unset? inside of small functions, using it by itself,
has caused me some heartburn in the past.
example:
=s: func [
"Check for unset or none values and return an empty string if found"
v [any-type!]
][
either unset? get/any 'v
[""]
[any[v ""]]
] ;; end function
In the interpreter window, enter
>> help unset?
;; and
>> help get
--
Tim Johnson <tim-johnsons-web.com>
http://www.alaska-internet-solutions.com