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
)


Paul Gauthier
APL Software Developer - Senior
[EMAIL PROTECTED]
Phone: 312-739-3467
Fax: 312-739-3496

CheckFree. The Company that Powers Payment on the WebSM.
http://www.checkfree.com/paybillsonline
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to