At 8:58 AM -0500 3/26/02, Clinton A. Pierce wrote:
>I took one of the smaller problems from the BASIC interpreter,
>sorting the stack, and posed it as a question on PerlMonks to see
>how a Mongolian Horde would handle the problem. The results are at:
>
> http://www.perlmonks.org/index.pl?node_id=153974
>
>Summary: the only apparent way to do this trick is with a variation
>of a bubble sort (which I already had) given that there's only one
>user stack and three stack instructions (save, restore, rotate_up).
>A quicksort solution was posted, except that without being able to
>randomly address the stack it's nearly as bad as a bubblesort.
Hrm. I'm not sure if random access to stack entries is worth the
hassle, but I'm not against it either if someone would care to whip
up a C<peek> opcode. (Suggestions for storage op names are welcome,
and no, poke doesn't do it)
Having a stack entry swap opcode is probably in order too.
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk