move_to_front
3 ( C.~ 1&,;0&,)~ 'abc*ef'
*acbef
On 31-01-12 16:44, David Ward Lambert wrote:
> Are there simple versions of swap and of move_to_front that use C. , A.
> or (other)? My definitions use amend. Thank you, Dave.
>
> 1 5 swap 'abcdefgh'
> afcdebgh
>
> 3 move_to_front 'abc*ef'
> *abcef
>
>
> swap=: ({~ |.)~`[`]}
> move_to_front=: ((({~ _1&|.)~`[`]})~ i.@:>:)~
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm