Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Puzzle with FIND and SELECT

From: rgombert:essentiel at: 7-Feb-2003 20:21

it seem that rebol say "same" when two values refer to the same object (place in memory) or, if they are "atomic" values such as numbers or chars if they are equal considering their value.
>> a: #"4" >> same? a #"4"
== true
>> same? :a #"4"
== true
>> b: 3 >> same? b 3
== true
>> same? :b 3
== true
>> same? 95 + 5 200 / 2
== true
>> txt: "foo" >> list: reduce [100 "foo" txt] >> same? list/1 100.0
== true
>> same? list/2 "foo"
== false
>> same? list/2 txt
== false
>> same? list/3 "foo"
== false
>> same? list/3 txt
== true So when 'same? have to examine objects that it is not relevant to compare by their location in memory they are compared by their value. For "ideal" objects such as numbers, they effectively are the same if their value is, wherether they could be ;-) Renaud GOMBERT -------------------------------- www.essentiel.net