You can use the verb display to see what the interpreter thinks of your
input verb. For example, having chosen the box & tree & parens display
form, I get:
y=: 3
,./^:2@(*/)^:y NB. input
┌───────────────────────┬──┬─┐
│┌─────────────┬─┬─────┐│^:│3│
││┌──────┬──┬─┐│@│┌─┬─┐││ │ │
│││┌──┬─┐│^:│2││ ││*│/│││ │ │
││││,.│/││ │ ││ │└─┴─┘││ │ │
│││└──┴─┘│ │ ││ │ ││ │ │
││└──────┴──┴─┘│ │ ││ │ │
│└─────────────┴─┴─────┘│ │ │
└───────────────────────┴──┴─┘
┌─ / ─── ,.
┌─ ^: ─┴─ 2
┌─ @ ─┤
── ^: ─┤ └─ / ──── *
└─ 3
(((,./)^:2)@(*/))^:3
,./^:2@((*/)^:y) NB. a different input input
┌─────────────┬─┬────────────┐
│┌──────┬──┬─┐│@│┌─────┬──┬─┐│
││┌──┬─┐│^:│2││ ││┌─┬─┐│^:│3││
│││,.│/││ │ ││ │││*│/││ │ ││
││└──┴─┘│ │ ││ ││└─┴─┘│ │ ││
│└──────┴──┴─┘│ │└─────┴──┴─┘│
└─────────────┴─┴────────────┘
┌─ / ─── ,.
┌─ ^: ─┴─ 2
│
── @ ─┤ ┌─ / ─── *
└─ ^: ─┴─ 3
((,./)^:2)@((*/)^:3)
The left operand of an operator (adverb or conjunction) is the entire verb
phrase on its left.
On Sat, Dec 2, 2017 at 10:02 AM, Andrew Dabrowski <[email protected]>
wrote:
> On 12/02/2017 02:17 AM, Roger Hui wrote:
>
> SC =: 3 : '(3 3$4>i.5) ,./^:2@(*/)^:y ,.1'
>>>>
>>> SC confuses me. I would have thought that
>>>
>>> (3 3$4>i.5) (*/)^:y ,.1
>>>
>> The left operand of the power operator ^: is ,./^:2@(*/) .
>>
>> Oh, I parsed it as
>
> (3 3$4>i.5) (,./^:2) @ ((*/)^:y) ,.1
>
> but it should be
>
> (3 3$4>i.5) (,./^:2 @ */)^:y ,.1
>
> is that right? I'm certainly not au courant in all the exceptions to
> right-association.
>
> Btw, does the cut function ;._3 have an inverse that could be used to
> solve this problem?
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm