[Jprogramming] @ and @: (atop and at)
Raul Miller
rauldmiller at gmail.com
Fri Jan 22 16:03:46 UTC 2016
Order is important.
Do you see why?
(Hint: it has to do with implicit parenthesis provided by parsing.)
Thanks,
--
Raul
On Fri, Jan 22, 2016 at 10:55 AM, Brian Schott <schott.brian at gmail.com> wrote:
> [Sorry, that was a mistake. This is a resend]
>
> #@:>@:;:'a man a plan a canal' NB. 1
> 6
> #@:>@;:'a man a plan a canal' NB. 2
> 6
> #@>@;:'a man a plan a canal' NB. 3
> 1 3 1 4 1 5
> #@>@:;:'a man a plan a canal' NB. 4
> 1 3 1 4 1 5
> #@(>@:;:)'a man a plan a canal' NB. 5
> 6
> #@(>@;:)'a man a plan a canal' NB. 6
> 6
>
> These examples are hard for me to grok.
> Comparing 1 and 2 and 4 suggests that either order is important or that #
> is effected and > is not.
> Example 6 suggests that parentheses can produce results like @: especially
> when compared with 2.
>
> My experience in the past has been especially puzzling when I try to
> combine atop with the MIDDLE TINE result of a fork as the following
> examples attempt to cover. In these example I use at and atop in the names
> to reflect the use of @ and @: ; I use app in the names to reflect the use
> of append . These examples especially the comparison between the
> application of meanatop and meanatopapp, clarify to me that atop uses the
> rank of its predecessor (%
>
> mean i. 3 4
> 4 5 6 7
> meanat =: +/ #@% #
> meanat i. 3 4
> 1 1 1 1
> meanatop =: +/ #@:% #
> meanatop i. 3 4
> 4
> meanatapp =: +/ #@,@% #
> meanatapp i. 3 4
> 1 1 1 1
> meanatopapp =: +/ #@:,@% #
> meanatopapp i. 3 4
> 1 1 1 1
> meanatopappparen =: +/ #@(,@%) #
> meanatopappparen i. 3 4
> 1 1 1 1
> meanatappparen =: +/ #@:(,@%) #
> meanatappparen i. 3 4
> 4
>
>
> On Fri, Jan 22, 2016 at 4:50 AM, Linda A Alvord <lindaalvord at verizon.net>
> wrote:
> I think I finally understand the difference!
>
> A=:'a man a plan a canal'
> ;:A
> ┌─┬───┬─┬────┬─┬─────┐
> │a│man│a│plan│a│canal│
> └─┴───┴─┴────┴─┴─────┘
> f=: 13 :'#>;:y'
> g=: 13 :'#@>;:y'
> h=: 13 :'#@:>;:y'
>
>
> --
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list