['=]
[1/10] from: hallvard:ystad:oops-as:no at: 26-Oct-2004 23:49
Cool subject line, huh?
This probably has been asked before, but I couldn't find it on rebol.org, so here goes.
This is a little something from a console session that puzzles me:
>> source =: native [
"Returns TRUE if the values are equal."
value1 value2
]
>> http://www.rebol.com/ = http://www.rebol.com/ ; should return true
== true
>> http://www.rebol.com/ = "http://www.rebol.com/" ; should also return true
== false
>>
This, on the other hand, is as expected:
>> source ==
==: native [
{Returns TRUE if the values are equal and of the same datatype.}
value1 value2
]
>> http://www.rebol.com/ == "http://www.rebol.com/" ; should return false
== false
>>
Could someone please enlighten me on the first one? Why don't both examples return true?
HY
[2/10] from: chalz::earthlink::net at: 26-Oct-2004 18:08
[3/10] from: ammon:johnson::gmail at: 26-Oct-2004 15:17
You're seeing that the mail list doesn't like something about
Hallvard's email encoding...
That is an '=' equals symbol.
On Tue, 26 Oct 2004 18:08:40 -0400, Charles <[chalz--earthlink--net]> wrote:
> >>> source
> > =: native [
<<quoted lines omitted: 5>>
> To unsubscribe from the list, just send an email to rebol-request
> at rebol.com with unsubscribe as the subject.
--
Enjoy!!
~~Ammon ;~[)
~Sui Generis~
[4/10] from: pwawood:mango:my at: 27-Oct-2004 6:23
Hallvard
>> http://www.rebol.com = "http://www.rebol.com"
== false
Because:
>> type? http://www.rebol.com
== url!
>> type? "http://www.rebol.com"
== string!
So use :
>>http://www.rebol.com = to-url "http://www.rebol.com"
== true
The clue is in the comments of the source of '
> {Returns TRUE if the values are equal and of the same datatype.}
Hope this helps.
Peter
On Wednesday, Oct 27, 2004, at 05:49 Asia/Kuala_Lumpur, Hallvard Ystad
wrote:
[5/10] from: antonr::lexicon::net at: 27-Oct-2004 12:37
Yes, but consider this:
>> 1.0 = 1
== true
>> type? 1.0
== decimal!
>> type? 1
== integer!
I agree with Hallvard that it is strange
that two any-string!s must be strict-equal to
be equal.
Anton.
[6/10] from: lmecir::mbox::vol::cz at: 27-Oct-2004 10:40
Anton Rolls napsal(a):
>Yes, but consider this:
>>>1.0 = 1
<<quoted lines omitted: 13>>
>be equal.
>Anton.
there is another difference between the two operators - the = operator
ignores case, while == doesn't ignore case for strings
-L
[7/10] from: pwawood:mango:my at: 27-Oct-2004 20:33
Anton
A very good point. Obviously some datatypes are more equal than others.
;-)))
I think the explanation is that both 1 and 1.0 are number datatypes.
From the little I know Rebol freely converts between the number
datatypes.
>> 1 = "1"
== false
is consistent with Harvard's url = string "funny".
Regards
Peter
On Wednesday, Oct 27, 2004, at 10:37 Asia/Kuala_Lumpur, Anton Rolls
wrote:
[8/10] from: lmecir::mbox::vol::cz at: 27-Oct-2004 16:10
Peter WA Wood napsal(a):
>Anton
>
>A very good point. Obviously some datatypes are more equal than others.
>;-)))
>
If you want Rebol to become more consistent in this point, you can store
it to Rambo.
-Ladislav
[9/10] from: pwawood::mango::net::my at: 29-Oct-2004 7:42
Ladislav
I'm not sure whether it's a bug or simply unclear documentation. I
always trip up over the following example:
>> (first "1234567890") = "1"
== false
until I remember that first returns a char!
>> (first "1234567890") = #"1"
== true
So I will follow your advice and submit this question to RT either
through feedback or directly to RAMBO
Help = Returns TRUE if the values are equal.
Help == Returns TRUE if the values are equal and of the same datatype.
Implies that values can be equal regardless of datatype. {This in
itself seems a little incongruous given that it is a value which has a
datatype not a word.}
I will report back RT's response to the Mailing List.
Regards
Peter
I
On Wednesday, Oct 27, 2004, at 22:10 Asia/Kuala_Lumpur, Ladislav Mecir
wrote:
[10/10] from: hallvard::ystad::oops-as::no at: 31-Oct-2004 23:54
Dixit Peter:
>Help = Returns TRUE if the values are equal.
>Help == Returns TRUE if the values are equal and of the same datatype.
>
>Implies that values can be equal regardless of datatype. {This in
>itself seems a little incongruous given that it is a value which has a
>datatype not a word.}
>
>I will report back RT's response to the Mailing List.
Thanks. I notice that in other cases, different datatypes containing the "same" data
_are_ treated as equal, even though it's not documented:
>> replace a: [1 56 #"w" 'g] "w" "wsfg"
== [1 56 #"w" 'g]
HELP REPLACE doesn't indicate that #"w" and "w" will be treated as being the same thing
in this case.
Regards,
Hallvard
PS to Ladislav et al.: I didn't learn much from studying my mail server log. I still
cannot understand why I do not get any messages from the list. Hope the problem will
be fixed soon, I really miss all this email (would you believe it?). Contrary to what
Carl evangelizes, I find email to be a very useful and practical way of communicating.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted