[comp.sys.handhelds] A few 'might be useful' programs

alonzo@microsoft.UUCP (Alonzo Gariepy) (11/11/89)

In article <266@sigma2.sm.luth.se> <d89-bfr@sigma2.sm.luth.se> writes:
> REV[B929]		; Reverses a list. Try VARS REV. You sould now have
> << DUP SIZE -> list n	; the variable list in reversed order.
>   <<
>     IF n
>     THEN |ost 2 n
> SUB REV list 1 GET +
>     ELSE { }
>     END
>   >>
> >>

Here is a simpler, faster list reverser.

REV
<< LIST-> 1 SWAP FOR j j ROLL NEXT LAST ->LIST >>

Non-recursive solutions are more intuitive for all these linear alorithms.
I like the quicksort which, of course, lends itself to recursion.

Alonzo Gariepy
alonzo@microsoft