Ah!  The partial lists for C. confused me.  mtf_under does not
reorganize the rest of the list.

   9!:7'+++++++++|-'

   mtf_under=: C.&.|.

   mtf_aai=: (C.~ 1&, ; 0&,)~ 

   ]a=: 2 (mtf_under ,: mtf_aai) i.7
4 0 1 2 3 5 6
2 0 1 3 4 5 6

   C. a
+---------+-+-+-+-+
|4 3 2 1 0|5|6| | |
+---------+-+-+-+-+
|2 1 0    |3|4|5|6|
+---------+-+-+-+-+

Thank you again.  The experiments I tried before asking were...flawed.

> Date: Tue, 31 Jan 2012 10:44:53 -0500
> From: David Ward Lambert <b49p23t...@stny.rr.com>
> Subject: [Jprogramming] Understanding C. , A.
> Message-ID: <1328024693.27264.19.camel@lambertdw>
> 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

Reply via email to