#51 · sam_nead
14 Jun 2007
Right, here is another example
[ 3, 3 ],[ 6, 8 ],2,[ <, k>, <, k>, <, l> ]
[ 3, 3, 3, 3 ],[ 4 ],2,[ <, l>, <, l> ]
These are out of order because 3 < 6L.
Public forum discussion.
14 Jun 2007
Right, here is another example
[ 3, 3 ],[ 6, 8 ],2,[ <, k>, <, k>, <, l> ]
[ 3, 3, 3, 3 ],[ 4 ],2,[ <, l>, <, l> ]
These are out of order because 3 < 6L.
14 Jun 2007
I've written some pseudo-code for lex, if you like.
14 Jun 2007
Try sam4.txt.
14 Jun 2007
Hmmm. This looks correct! But it still has a weird feel to it. For example the two lines
[ 3, 4, 5, 5 ],[ 4, 4 ],1,[ <, k>, <, l> ]
[ 3, 4 ],[ 4 ],1,[ <, l> ]
are correctly sorted. But they feel odd: shouldn't a subposition appear before a superposition? I think that sam3.txt had this nice property...
Well, I will stop making requests and actually look at the data. Here, I can't resist posting my lex-code. Is it right?
/\* Suppose we have a ordered alphabet. Suppose we have two words, U and V, over this alphabet. I'll denote the i^th character of U by U[i], starting at zero. So if U = aabca then U[0] = a, U[2] = b, and so on. As a convention, I'll assume that U[length of U] is the "empty character" which is smaller than all other characters (including itself!). */
which_is_less(U, V)
{
i = 0;
while 0 == 0
{
if U[i] < V[i] return U;
if V[i] < U[i] return V;
i = i + 1;
}
}
14 Jun 2007
Ack! The forum ate the formatting!
14 Jun 2007
In your code: I guess you should check U isn't equal to V at some point :-)
You were barking up the wrong tree though---the problem was not in my lex implementation, it was typos (e.g. at one point I mistyped 2 for 1 and hence concatenated the chains in game 1 to the loops in game 2 by accident etc).
As for "weird feels"---as far as I'm concerned this is in the eye of the beholder :-) If you can write a lex code then you can read a perl manual and go ahead and learn to manipulate the data to your hearts content :-)
14 Jun 2007
Thanks for the files. I will now bathe in the data.
14 Jun 2007
"In your code: I guess you should check U isn't equal to V at some point :-)"
Nope! If they are equal then the "empty character" at the end makes us return U. ;)
14 Jun 2007
If you're happy with that behaviour then perhaps your function should be called "which_is_at_most" :-)