(Of course, use ((].~) @:) :[: to force monadic valence for full parity with
the original.)
On Wed, 20 Apr 2022, Elijah Stone wrote:
I'll give a more thorough response later, if somebody else doesn't beat me to
it. For the time being:
1. [. and ]. are tacit u and v in the same sense that [ and ] are tacit x and
y. (And ]: is the adverbial counterpart.)
2. Creation of arbitrary forks is difficult with tacit (unless you cheat and
use ` and `:). Only option is AAV, which does not let you combine u and v;
better to use hooks if possible. An explicit rendering of your original AA
using a hook is: {{ v~ u@:v }}. A tacit rendering, then, is (].~) @: .
On Thu, 21 Apr 2022, Michal Wallace wrote:
I want to write this tacitly:
AA =: {{ (u v y) v y }}
For context, I tend to use it to *A*pply monad u *A*t at a location
specified by ambivalent verb v.
AT =: {{ m&{:: : (<@[ m} ]) }}
3 AT ;/i.10
3
_ (3 AT) ;/i.10
+-+-+-+-+-+-+-+-+-+-+
|0|1|2|_|4|5|6|7|8|9|
+-+-+-+-+-+-+-+-+-+-+
_: AA (3 AT) ;/i.10
+-+-+-+-+-+-+-+-+-+-+
|0|1|2|_|4|5|6|7|8|9|
+-+-+-+-+-+-+-+-+-+-+
My main question is "how do I write AA tacitly?", but I'd also like to
present my (incorrect) thinking here in hopes that someone can fix it. :)
I first translated it into a fork inside a direct definition, and that
works fine:
AA =: {{ ((u @: v) v ]) }}
_: AA (3 AT) ;/i.10
+-+-+-+-+-+-+-+-+-+-+
|0|1|2|_|4|5|6|7|8|9|
+-+-+-+-+-+-+-+-+-+-+
I then thought that replacing u => [. and v => ]. would let me remove the
double curlies, but clearly this is the wrong idea:
AA =: ([. @: ].) ]. ]
_: AA (3 AT) ;/i.10
+-+-+-+-+-+-+-+-+-+-+
|0|1|2|3|4|5|6|7|8|9|
+-+-+-+-+-+-+-+-+-+-+
I don't really understand what it's doing but I'm (mistakingly?) imagining
that it's a fork.
If it were a fork with ] on the right, I think I should be able to rewrite
it like so:
AA =: ].~ ([. @: ])
But this gives a syntax error.... Why?
So okay, if I just put ] back in on the left:
AA =: ] ].~ ([. @: ].)
_: AA (3 AT) ;/i.10
_
Clearly my idea that [. and ]. mean "tacit u and v" is wrong.
Can anyone help me correct my thinking?
Thanks!
-Michal
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm