Raul Miller gave:
> gnome=: swap~ 2 gt/\ ]
This is quite a neat soltion! If you like, you can record it at
RosettaCode:
http://rosettacode.org/wiki/Gnome_sort
> Here's a corrected version:
> gt=: -.@(-: /:~)@,:
I would prefer -.@(-: /:~)@,&< or (1 - 0 1 -: /:)@:,&< . For example:
'word' gt1 'word',TAB NB. using ,:
1
'word' gt2 'word',TAB NB. using ,&<
0
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm