Nope. You're using them dyadically.
When you embedded f and g in (... |.)"1 you made their context dyadic. That's
a hook, and by definition, its left tine (in your case, f or g) is always
invoked dyadically.
Protection from (or provision for) such contextual changes is actually one of
the major motivations for using & (as in =&{: ).
Maybe it's time to visit with & (and his conjunctival cousins, @: &. )? If for
no other reason, then just because "J" is much easier than "easy J" (just like
swimming downstream is much easier than swimming upstream). And more fun, too
(ditto).
-Dan
Please excuse typos; composed on a handheld device.
On Oct 20, 2012, at 2:57 AM, "Linda Alvord" <[email protected]> wrote:
> I am using them monadically.
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of km
> Sent: Saturday, October 20, 2012 2:54 AM
> To: [email protected]
> Subject: Re: [Jprogramming] stitching matrices
>
> Identical?
>
> f =: =&{:
> g =: [:={:
> 1 4 f 2 3 4
> 1
> 1 4 g 2 3 4
> |domain error: g
> | 1 4 g 2 3 4
>
> Kip Murray
>
> Sent from my iPad
>
>
> On Oct 20, 2012, at 1:11 AM, "Linda Alvord" <[email protected]> wrote:
>
>> Here's a problem that bothers me about this example before I leave it.
>>
>>
>>
>> First establish that =&{: and [:={: are identical and compare tree
>> and boxed versions:
>>
>>
>>
>>
>>
>> ]'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
>>
>> ----------T-------┐
>> │0 1 2 0 1│0 1 2 0│
>> │2 0 1 2 0│1 2 0 1│
>> │1 2 0 1 2│2 0 1 2│
>> │ │0 1 2 0│
>> │ │1 2 0 1│
>> L---------+--------
>>
>> f=:=&{:
>>
>> g=:[:={:
>>
>> 5!:4 <'f'
>>
>> -- =
>> -- & -+- {:
>>
>> 5!:4 <'g'
>>
>> -- [:
>> --+- =
>> L- {:
>>
>> B
>>
>> 0 1 2 0
>> 1 2 0 1
>> 2 0 1 2
>> 0 1 2 0
>> 1 2 0 1
>>
>> f B
>>
>> 1 0 0 1
>> 0 1 0 0
>> 0 0 1 0
>>
>> g B
>>
>> 1 0 0 1
>> 0 1 0 0
>> 0 0 1 0
>>
>>
>>
>> Now look at two "trees":
>>
>>
>>
>> elm=: 13 :'((=&{:)|.)"1 y'
>>
>> oak=: 13 :'(([:={:)|.)"1 y'
>>
>> 5!:4 <'elm'
>>
>> -- =
>> -- & -+- {:
>> ----+- |.
>> -- " -+- 1
>>
>> 5!:4 <'oak'
>>
>> -- [:
>> -----+- =
>> ----+ L- {:
>> -- " -+ L- |.
>> L- 1
>>
>> 5!:2 <'elm'
>>
>> --------------T-T-┐
>> │---------T--┐│"│1│
>> ││--T-T--┐│|.││ │ │
>> │││=│&│{:││ ││ │ │
>> ││L-+-+---│ ││ │ │
>> │L--------+---│ │ │
>> L-------------+-+--
>>
>> 5!:2 <'oak'
>>
>> ---------------T-T-┐
>> │----------T--┐│"│1│
>> ││---T-T--┐│|.││ │ │
>> │││[:│=│{:││ ││ │ │
>> ││L--+-+---│ ││ │ │
>> │L---------+---│ │ │
>> L--------------+-+--
>>
>> B
>>
>> 0 1 2 0
>> 1 2 0 1
>> 2 0 1 2
>> 0 1 2 0
>> 1 2 0 1
>>
>> elm B
>>
>> 1 1 1 1 1
>>
>> oak B
>>
>> ran with error:
>> |domain error: oak
>> | oak B
>> |[-16] c:\users\owner\j701-user\temp\42.ij
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm