First of all, thank you for the comment. I fully agree that grading is
a much useful and higher concept than sorting.
However, in the following code:
mycmp=: 3 : 0
wt=. ;#&.> y
;(/:&.> lower L: 0) (\: ~. wt) { wt </. y
)
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".
2008/3/13, Devon McCormick <[EMAIL PROTECTED]>:
> Hi -
>
> I think you're probably right about the J solution missing the point of the
> problem.
>
> However, as is common in these sort of comparisons, the problem also misses
> the point of J. The advantage J brings is not in slavishly duplicating ways
> that other languages work but in adding new perspective. In this case, the
> problem misses out on the tremendous advantage of grading versus sorting.
>
> I'm working on an exposition of these advantages and would welcome any
> examples people can come up with.
>
> Devon
>
> On 3/13/08, June Kim <[EMAIL PROTECTED]> wrote:
> >
> > Hello,
> >
> > Look at the J code at
> > http://www.rosettacode.org/wiki/Sorting_Using_a_Custom_Comparator#J
> >
> > I think it misses the point of the problem. It asks to show the
> > sorting facility of a programming language using a custom comparator,
> > that is a tailored sorting facility. The variability should be
> > pluggable. Look at the other solutions.
> >
> > The J solution given doesn't show that a flexible and pluggable
> > sorting facility.
> >
> > For example, I think the following code is aimed closer to the point
> > of the problem:
> > load 'strings'
> > sortby=: 1 : '] \: u&.>'
> > (# ,[:-[: a.&i. tolower) sortby strings
> >
> > I am not sure if mine is a good J-ic approach. I'd be happy to see
> > more J-ic way of doing it. Thanks.
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
>
> --
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm