rebol - How to compare to none -


i have following block of data:

client: ["id" "1234" "name" "foobar" "custom_ip" none] 

strangely, comparing "none" never seems work.

if none = (select client "custom_ip") [print "yay!"] 

though when print select client "custom_ip" returns "none".

why this? can determine that value none?

there difference between literal value of type none! , word! spelling none.

one can (rightfully, imo) call bug console not differentiate these when giving output of expression:

>> none  ;-- word! looked value == none  ;-- value, , it's *not* word! 

to less deceptive response console of value none word evaluated in case, can use mold/all

>> print mold/all none == #[none] 

or can show type of result instead of result itself:

>> type? none == none! 

although that's deceptive in sense similar reasons, looks word none! when it's datatype...

>> type? type? none == datatype! 

anyway, got in example word none, hence:

>> if 'none = (select client "custom_ip") [print "oh..."] oh... 

deceiving console output aside, it's doing predictable thing. there shorthand #[none] in rebol3 literal nones of #:

>> client: ["id" "1234" "name" "foobar" "custom_ip" #] >> if none = (select client "custom_ip") [print "hmm..."] hmm... 

but construction syntax in flux in general; it's hard ultimate answer be.

mostly aware of distinction between word none , value of type none!, despite basic console's dodgy output. (i'll mention ren garden, instance, uses mold/all)


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -