PAIR! and greater-than less-than
[1/5] from: reboler::programmer::net at: 25-Feb-2002 15:02
What's up with the following /CORE console output?
>> 10x20 > 10x25
** Script Error: Expected one of: pair! - not: pair! ** Where: halt-view ** Near: 10x20 > 10x25
>> minimum 10x20 5x25
[2/5] from: chalz:earthlink at: 26-Feb-2002 1:14
I think we've been over this before on this list. Besides, if you look at the output from 'minimum, what it did was return a new PAIR! which contains the minimum values from each half of each given PAIR!. It's basically been decided you can't really compare PAIR! values for greater/less-than, because how do you *define* which is greater and which is less? But 'minimum just takes something like 'minimum AxB CxD and returns ExF, where E is the smaller of A and C, and F is the smaller of B and D. Pretty basic. Not sure, myself, what use it is, but hell, there it is. --Charles
> What's up with the following /CORE console output? > >> 10x20 > 10x25
<<quoted lines omitted: 9>>> http://www.mail.com/?sr=signup > 1 cent a minute calls anywhere in the U.S.!
[3/5] from: carl:cybercraft at: 26-Feb-2002 19:22
On 26-Feb-02, alan parman wrote:
> What's up with the following /CORE console output? >>> 10x20 > 10x25 > ** Script Error: Expected one of: pair! - not: pair! > ** Where: halt-view > ** Near: 10x20 > 10x25
You can't compare pairs for greater-than or lesser-than in REBOL. The resons why were discussed exaustively on the list recently. If you're looking for a long read, search for "pair" in the escribe archive here... http://www.escribe.com/internet/rebol/ and choose the "Tuples - Was Pair! thread" and "Pair comparison (was: native? :==)" threads.
>>> minimum 10x20 5x25 > == 5x20
That's expected behaviour, and useful too. Gregg Irwin's written a good article on pairs here... http://www.rebolforces.com/articles/pairs1.html which explains it a lot better than I could. Well worth a read. -- Carl Read
[4/5] from: cyphre:seznam:cz at: 26-Feb-2002 11:33
Hi Charles, Carl and all, Just wanted to mention two mezzanine fuctions 'inside? and 'outside? which you could find sometimes very usefull.
>> ? inside?
USAGE: INSIDE? p1 p2 DESCRIPTION: TRUE if both X and Y of the second pair are less than the first. INSIDE? is a function value. ARGUMENTS: p1 -- (Type: pair) p2 -- (Type: pair)
>> ? outside?
USAGE: OUTSIDE? p1 p2 DESCRIPTION: TRUE if either X and Y of the second pair are greater than the first. OUTSIDE? is a function value. ARGUMENTS: p1 -- (Type: pair) p2 -- (Type: pair)
[5/5] from: carl:cybercraft at: 27-Feb-2002 7:55
On 26-Feb-02, Cyphre wrote:
> Hi Charles, Carl and all, > Just wanted to mention two mezzanine fuctions 'inside? and 'outside? > which you could find sometimes very usefull.
Cool. I could've used those a while back. Now why didn't they get a mention in the pair discussions I mentioned? (Though I guess I could've missed it:)
>>> ? inside? > USAGE:
<<quoted lines omitted: 51>>>> [rebol-request--rebol--com] with "unsubscribe" in the >> subject, without the quotes.
-- Carl Read
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted