Henry, I can't make your suggestion work.
a
0 1 0 1 0 4
b
0 0 2 3 2 3
i=: 13 :'(=x) #@# y'
i
] #@#~ [: = [
a i b
3 2 1
NB. ([: f g)"({. g b. 0) <=> f@g
k=: ] (([: # #)"({.# b. 0))~ [: = [
k
] ([: # #)"_~ [: = [
a k b
3
What am I missing?
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Henry Rich
Sent: Friday, December 21, 2012 1:52 PM
To: [email protected]
Subject: Re: [Jprogramming] A Tree Question
Writing J without @@: is like writing English without the letter 'e'. I don't
know what it shows, and it sounds funny, but look! I did it.
([: f g) <=> f@:g
([: f g)"({. g b. 0) <=> f@g
Henry Rich
On 12/21/2012 1:30 PM, Linda Alvord wrote:
> So how can you write an equivalent explicit expression that will have the
> same result of g without @ or @: ?
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of bob
> therriault
> Sent: Friday, December 21, 2012 1:02 PM
> To: [email protected]
> Subject: Re: [Jprogramming] A Tree Question
>
> Hi LInda,
>
> Since forks result in verbs of infinite rank (unless changed by the
> rank conjunction), #@# is not actually equivalent to ([:##), although
> #@:# is. Watch what happens when I swap @: for @
>
> g=: 13 :'(=x) #@# y'
> a=:0 0 1 0 1 5
> b=:0 1 1 3 2 3
> a g b
> 3 2 1
> g1=:13 :'(=x) #@:# y'
> a g1 b
> 3
>
> Cheers, bob
>
> On 2012-12-21, at 9:51 AM, Linda Alvord wrote:
>
>> Why do the trees of g and h appear to agree, but their results are
>> not the same?
>>
>>
>>
>> ]a=:?>:i.6
>>
>> 0 0 1 0 1 5
>>
>> ]b=:?>:i.6
>>
>> 0 1 1 3 2 3
>>
>> f=: 13 :'x#/.y'
>>
>> f
>>
>> #/.
>>
>> a f b
>>
>> 3 2 1
>>
>> g=: 13 :'(=x) #@# y'
>>
>> g
>>
>> ] #@#~ [: = [
>>
>> a g b
>>
>> 3 2 1
>>
>> NB. x u@v y ↔ u x v y
>>
>> h=: 13 :'(=x) ([:##) y']
>>
>> h
>>
>> (] ([: # #)~ [: = [) ]
>>
>> a h b
>>
>> 3
>>
>> 5!:4 <'g'
>>
>> ┌─ ]
>> │ ┌─ #
>> ├─ ~ ─── @ ─┴─ #
>> ──┤
>> │ ┌─ [:
>> └─────┼─ =
>> └─ [
>>
>> 5!:4 <'h'
>>
>> ┌─ ]
>> │ ┌─ [:
>> ├─ ~ ──────┼─ #
>> ┌───┤ └─ #
>> │ │ ┌─ [:
>> ──┤ └─────┼─ =
>> │ └─ [
>> └─ ]
>>
>> g
>>
>> ] #@#~ [: = [
>>
>> h
>>
>> (] ([: # #)~ [: = [) ]
>>
>>
>>
>> Backtracking i and j are OK.
>>
>>
>>
>> i=: 13 :'x #@# y'
>>
>> i
>>
>> #@#
>>
>> a i b
>>
>> 7
>>
>> j=: 13 :'#x#y'
>>
>> j
>>
>> [: # #
>>
>> a j b
>>
>> 7
>>
>> 5!:4 <'i'
>>
>> ┌─ #
>> ── @ ─┴─ #
>>
>> 5!:4 <'j'
>>
>> ┌─ [:
>> ──┼─ #
>> └─ #
>>
>>
>>
>> I have tried to include rank of the verbs but I haven’t found the
>> right combination if that is what is necessary.
>>
>>
>>
>> Linda
>>
>> ---------------------------------------------------------------------
>> - 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm