[REBOL] Re: From word to none
From: g:santilli:tiscalinet:it at: 19-Jun-2003 10:01
Hi Hallvard,
On Wednesday, June 18, 2003, 10:03:15 PM, you wrote:
HY> make hash! ["some string" none none "some string" 55 438 {"29621"} ]
If you're on a recent version of REBOL, you can write it as:
#[hash! ["some string" #[none] #[none] "some string" 55 438 {"29621"}]]
that will directly load into the correct values (without needing
the DO to make the hash!). To save values in this format, use
SAVE/ALL (or MOLD/ALL).
HY> I go through the hash with foreach, like this:
HY> foreach [a b c] hash [
HY> if none? b [ print "We've got a none! value" ]
HY> ]
Or, if you can't do the above because you're on an older version
of REBOL, you could:
forall hash [if 'none = pick hash 1 [hash/1: none]]
hash: head hash
Then you can use it normally. (If you don't have anything but
strings in it, you could also just REDUCE it.)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r