I note that the verbs fail when the argument
has 1 item.  e.g.

   tgu 5



----- Original Message -----
From: [EMAIL PROTECTED]
Date: Thursday, May 31, 2007 3:23 pm
Subject: [Jgeneral] Re: Challenge to expert J'ers

> Anyone could do magic and make those verbs scream ?
> 
> There are two verbs that I use extensively to do transaction 
> matching and 
> they require a tolerant sort.
> I copied naively the APL code I had as J code to form two verbs:
> tgu (tolerant grade up)
> tgd (tolerant grade down)
> 
> here is an example of their application:
>   a=:(1+i.3),(1+i.3)-9!:18''
>   /: a
> 3 0 4 1 5 2
>   tgu a
> 0 3 1 4 2 5
>   \: a
> 2 5 1 4 0 3
>   tgd a
> 5 2 4 1 3 0
> 
> and here they are (please forgive the naive implementation)
> 
> tgu=: 3 : 0
> ix=./:y
> sy=.ix{y
> p=.sy~:_1|.sy
> sy=.p < ;.1 ix{i.#y
> ;(/:&.>sy){&.>sy
> )
> 
> tgd=: 3 : 0
> ix=.\:y
> sy=.ix{y
> p=.sy~:_1|.sy
> sy=.p < ;.1 ix{i.#y
> ;(\:&.>sy){&.>sy
> )
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to