Terrence Brannon asked:
> so the 2nd question is how to do this statefuly:
> ( (5 {.) ; (3 }. 11 {.) ; ( 8 }. 16 }. ) ; ( 24 }. ) ) alpha
J, being a functional language, often eschews state. For partitioning a
string, I suggest you look at the cut conjunction (;.). Here's an example of
its use:
(_2 ,:/\ 0 4 3 10 24 25 24 25) <;.0 alpha
+----+----------+--+--+
|abcd|defghijklm|yz|yz|
+----+----------+--+--+
> the first question is how to get a series of monadic verbs to
> each be applied to the same noun and then get each application
> stored in a box
If I understand the question properly, you several options. Here are some,
listed in ascending order of difficulty to generalize:
13 : '(5 {.y) ; ( 3 }. 11 {.y) ; ( 8 }. 16 }.y) ; 24 }.y'
alpha
+-----+--------+--+--+
|abcde|defghijk|yz|yz|
+-----+--------+--+--+
((5 {.]) ; ( 3 }. 11 {.]) ; ( 8 }. 16 }.]) ; 24 }.] )
alpha
+-----+--------+--+--+
|abcde|defghijk|yz|yz|
+-----+--------+--+--+
( 5&{. ; ([: 3&}. 11&{.) ; ([: 8&}. 16&}.) ; 24&}. )
alpha
+-----+--------+--+--+
|abcde|defghijk|yz|yz|
+-----+--------+--+--+
( 5&{. ; 3&}.@:(11&{.) ; 8&}.@:(16&}.) ; 24&}. )
alpha
+-----+--------+--+--+
|abcde|defghijk|yz|yz|
+-----+--------+--+--+
And a bonus:
require'doog' NB.
http://www.jsoftware.com/svn/DanBron/trunk/general/doog.ijs
< At ((5 {.]) ` ( 3 }. 11 {.]) ` ( 8 }. 16 }.]) `(24
}.]))`:0 alpha
+-----+--------+--+--+
|abcde|defghijk|yz|yz|
+-----+--------+--+--+
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm