World: r3wp
[!REBOL2 Releases] Discuss 2.x releases
older newer | first last |
Graham 17-Apr-2010 [1528] | Eh? I've seen you here most days! :) |
BrianH 17-Apr-2010 [1529] | I pop in, but haven't had much time to code. When I've been here lately I'm too exhausted to program. |
Graham 17-Apr-2010 [1530] | In that case you have a list of jobs a mile long to do ... |
BrianH 17-Apr-2010 [1531] | Well, yeah. So what else is new? :) |
Graham 17-Apr-2010 [1532] | So, are you too exhausted today? :) |
BrianH 17-Apr-2010 [1533] | I'll be on next week, but this is the first time in two weeks that I've been able to spend more than a few minutes at home and I'm taking a break. |
Graham 25-Apr-2010 [1534] | It might be a good idea to patch in Cyphre's cookie handling support as well http://www.rebol.org/view-script.r?script=my-http.r |
BrianH 25-Apr-2010 [1535] | Looks good :) |
Gregg 25-Apr-2010 [1536] | I think he might have an updated version as well. Worth pinging him if he doesn't check in here. |
BrianH 25-Apr-2010 [1537] | Doesn't seem to parse the cookies, just passes them through. Probably good enough for a low-level protocol. |
Graham 27-Apr-2010 [1538] | Any updates here? |
Graham 29-Apr-2010 [1539x2] | this seems to be an oddity to me >> min 10x0 11x0 == 10x0 >> max 10x0 11x0 == 11x0 >> 10x0 > 11x0 ** Script Error: Expected one of: pair! - not: pair! ** Near: 10x0 > 11x0 |
so to get a greater than we have to do >> 10x0 = max 10x0 11x0 == false | |
Sunanda 29-Apr-2010 [1541] | Or use SORT and see which one comes first :) SORT embodies different logic to the GREATER?, LESSER? (etc) when it comes to implementing ordering. And that can sometimes be useful, or at least, usable. |
Pekr 29-Apr-2010 [1542] | Sort nicely worked for me, when sorting IP addresses. I switched from string type to tupple type upon BrianH's suggestion :-) It was initially "easier" for me to keep IPs as strings, but I was just lazy to use native REBOL dtype :-) |
BrianH 29-Apr-2010 [1543] | Graham, afaict the direct comparators don't support pair! because there are situations where the answer is ambiguous: >> 1x0 > 0x1 ** Script error: cannot compare pair! with pair! ** Where: > ** Near: > 0x1 >> max 1x0 0x1 == 1x1 |
Steeve 29-Apr-2010 [1544] | Always the same battle, Default behaviorists against Errors Creationists |
BrianH 29-Apr-2010 [1545x3] | Do you really want > and < to return none if they run into a ambiguous situation? Right now all of those functions return true or false. |
Imagine all the code that would have to change if we switched to SQL-style 3-value logic :( | |
But yes, good point :) | |
Steeve 29-Apr-2010 [1548x2] | No I want a default comparison scheme for pairs (even if it is not the one I think is the most usefull) . Error bombings are of no use |
What about the comparison of euclidean distances of 2 coordinates ? | |
BrianH 29-Apr-2010 [1550] | Bring it up with Carl for R3, or suggest it in CureCode. This is all a little off-topic for this group anyways - we should be in Core. |
Graham 29-Apr-2010 [1551x2] | I'll try sorting .. |
You can't use sort ! sort 10x10 11x11 | |
ChristianE 29-Apr-2010 [1553x2] | Use SORT/COMPARE if the default sort order doesn't word for your pairs. |
sort [10x10 11x11] | |
Graham 29-Apr-2010 [1555] | oh yeah ... |
ChristianE 29-Apr-2010 [1556] | SORT takes a block |
Graham 29-Apr-2010 [1557x2] | sort uses the x coordinate |
should have a sort/y :) | |
ChristianE 29-Apr-2010 [1559x2] | sort/compare pairs func [a b] [all [a/2 < b/2]] |
uses the Y coord. Use whatever sorting scheme you like. | |
Graham 29-Apr-2010 [1561] | yeah .... I had sort/reverse |
ChristianE 29-Apr-2010 [1562] | ALL [...] is of course wrong |
Graham 29-Apr-2010 [1563] | too early in the morning ... not awake yet |
ChristianE 29-Apr-2010 [1564x6] | func [a b] [a/2 < b/2] would have been better |
Wait, I somewhere have a handy COMPARE function for writing custom sort functions ... | |
Ok, here it is: | |
compare: func [ "Returns -1, 0 or 1 if the first value is lesser, equal, greater than the second value." a b /else "Return NONE when equal (useful to chain COMPARE)" ][ case [a < b -1 a > b 1 else [none] true 0] ] | |
sort/custom some-pairs func [a b] [compare/else a/2 b/2 compare a/1 a/2] | |
That would stable sort Y first, then X for a/y = b/y. Just for exemple's sake. | |
Graham 29-Apr-2010 [1570x4] | I'd suggest that pair1 > pair2 if the sum of its parts are larger than pair2 |
is a pair is greater if it is further from 0x0 | |
as the crow flies along the co-ordinate axis | |
but that could mean 100x0 = 0x100 :( | |
Sunanda 29-Apr-2010 [1574] | or [1x-2 = -2x1] :)) |
Graham 29-Apr-2010 [1575] | Christian, I am just compairing two pairs :) |
ChristianE 29-Apr-2010 [1576] | : ) Ok, I see! And that's where SORT 10x10 11x11 came from ;-) |
Graham 29-Apr-2010 [1577] | Just a simple issue! .... I have an image and I want to see if I need to enlarge it or not to fit into my box |
older newer | first last |