Is something along the lines of quicksort what you were thinking of.
http://www.jsoftware.com/jwiki/Essays/Quicksort
However, observe the essay's final remark:
"Note: This essay is meant to explore the workings of a classical algorithm.
To actually sort data in J, it is more convenient and more efficient
to use /:~ ."

sel=: 1 : 'x # ['
quicksort=: 3 : 0
 if. 1 >: #y do. y
 else.
  (quicksort y <sel e),(y =sel e),quicksort y >sel e=.y{~?#y
 end.
)


June Kim wrote:>
> and the code to run
>
> mycmp strings
>
>shows no way to change the behavior with another comparator(or way of
>,ordering) without changing the code inside mycmp verb, which means its
>"inextendability".
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to