[Jprogramming] A Tree Question
Raul Miller
rauldmiller at gmail.com
Fri Dec 21 18:35:28 UTC 2012
You can replace @ with a word like at, if you like:
at=:2 :0
([: u v)"v
)
--
Raul
On Fri, Dec 21, 2012 at 1:30 PM, Linda Alvord <lindaalvord at verizon.net> wrote:
> So how can you write an equivalent explicit expression that will have the same result of g without @ or @: ?
>
> -----Original Message-----
> From: programming-bounces at forums.jsoftware.com [mailto:programming-bounces at forums.jsoftware.com] On Behalf Of bob therriault
> Sent: Friday, December 21, 2012 1:02 PM
> To: programming at jsoftware.com
> 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 at 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
More information about the Programming
mailing list