On 4/28/08, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> bi=: <\ [EMAIL PROTECTED] NB. boxed indecies
> gt=: >/ NB. greater than
> repair=: C.~ _2&(gt\ # bi)
Oleg Kobchenko:
With verbs like _2 v\ ] you need to handle length 1 fragments
For example:
gt=: >/ NB. greater than
bi=: <\ [EMAIL PROTECTED] NB. boxed indecies
repair=: C.~ _2&(gt\ # bi)
bubsort=: repair @ ({. , [EMAIL PROTECTED])^:_
bubsort -i.9
|domain error: repair
However:
repair=: ] C.~ _2 (([EMAIL PROTECTED]: /:~)\ # (<\ [EMAIL PROTECTED])) ]
bubsort -i.9
_8 _7 _6 _5 _4 _3 _2 _1 0
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm