Roger wrote:
> b. What happens if fills are wanted before _and_ after
> the copied items?
I responded:
> b. Quaternions :)
While we're waiting for quaternions, here is a notation that approximates
how we'd use them with # . Of course this is just a start and will have
multiple issues, but I hope it gets the idea across:
decompose =: (,~ (( (-~#) ,~ 10 #. {.)~
1+i:&1@:~:&0)@:(10&#.^:_1) )~/@+.
mask =: <@(-@:(1&{) |. {. , 0 #~ +/@:}.)@decompose
expand =: ( ((+ =&0)@:] # (#^:_1!.'.'~ *)) ;@:mask ) ~
'..a.......bbb..........cccc......' -: 1e2j3 3e4j5 4e5j6 expand
'abc'
Here, the notation is NeBjA where N is the number of copies, B is the
number of fills before the copies, and A is the number of fills after the
copies. I wanted to use p or e in order to keep the numbers smaller (and
therefore retain more precision) but the constant hierarchy isn't right for
that purpose.
By the way, why must the left argument to #^:_1 be boolean? Why can't I
say, e.g. 0 0 4 0 0 #!.'x'^:_1 '!' to get 'xx!!!!xx' ? Another
enhancement request for # .
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm