Thank you for the reference.

Actually, I am happier with my solution:

  load 'strings'
  sortby=: 1 : '] \: u&.>'
  (# ,[:-[: a.&i. tolower) sortby strings

I reckon it is a more J-ic approach compared to the single mycmp verb
(which isn't friendly to composition and combination for extension and
variability) or the exemplary quicksort verb (of which intention I
guess is just showing how quicksort works) -- but I might be wrong.

2008/3/14, david alis <[EMAIL PROTECTED]>:
> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to