@lepinekong_twitter, at this stage in your Red career, if someone offers a hint, clue, or suggestion in answer to a question or problem you pose, please take some time to understand their response, rather than immediately saying "Why would I need to...?"
Do you understand the behavior now? If not, does this help?
type: word!
blk: [
unset! [
print "unset!"
]
word! string! file! url! block! [
print "word! string! file! url! block!"
]
]
switch type blk
find blk type
type? type
find blk type? type
type? first blk
find blk 'word!
switch type reduce blk
There should be no more explanation needed than this, and is an example of how to go about learning and debugging on your own.
@nedzadarek
>> type? first [integer!]
== word!
>> type? integer!
== datatype!
In the first case, the word inside the block is not evaluated (because nothing causes it to be evaluated), in the second case, the word is the argument of a function, so it gets evaluated (it evaluates to a datatype!
) . No quirks here, just basic evaluation rules of the language. Once we get syntax coloring in the console, it should be easier to spot the difference between values of different types having same literal form.
>> foo: 'bar
== bar
>> 'foo = foo
== false
Except that word is not a float, it's a separate entity which can refer to other values, including floats.
You are right. However Red users prefers to use X!
as to say "it's a word containing datatype". We can use pi!: 42
but it breaks conventions.
'foo
looks different than foo
. I may be biased but foo
looks like variable in most language (or some variable-like thing in language that doesn't like mutations). 'foo
looks like some kind of symbol or something. So I would assume that you are comparing some value 'foo
with variable foo
.
>> foo: 'foo
== foo
>> 'foo = foo
== true