[Jprogramming] Comparing non scalar data.

Mikl Kurkov mkurkov at newmail.ru
Fri Jan 27 04:59:29 HKT 2006


Hi All!
I'm working on my first program in J so I have some questions.

I wonder what is perferable method to compare vectors?
As I understand comparing functions like > <
are working only with scalars. Also for  >. <. .
But sorting eats all other data. So one of my desisions was:

max  =: {: @: /:~ : ({: @: /:~ @: ([ ,: ])) " _
min  =: {. @: /:~ : ({. @: /:~ @: ([ ,: ])) " _

less =:  ( ([ -: min) *. (-. at -:)) " _
more =:  ( ([ -: max) *. (-. at -:)) " _

It works but I think it dumb.
Another aproach I see is to convert all data to numbers and compare them.
But I don't like it too.

Isn't it possible to use the same comparing routines that sorting does?

-- 
Mikl


More information about the Programming mailing list