Suggestion:  Make more of a distinction between the data and the code.
 Thus:

x=: '@{ foo; if (abc) { if (q) { m; } } }'

+/\ 1 _1 0 {~ '{}' i. x





On Fri, Jan 17, 2014 at 7:50 AM, Joe Bogner <[email protected]> wrote:

> If it's helpful for the presentation, I wrote up how the parentheses
> nesting idiom looks in a few other languages:
>
> There are two relevant concepts - the array thinking and the implementation
>
> J
> +/\(1 _1 0){~'{}' i. '@{ foo; if (abc) { if (q) { m; } } }'
> 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 2 2 1 1 0
>
> Javascript
> var runsum=0;'@{ foo; if (abc) { if (q) { m; } }
> }'.split('').map(function(x) { var opp={'{':1,'}':-1}; return
> opp[x]||0;  }).map(function(x) { runsum = x+runsum; return runsum; })
> 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
> 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 1, 1, 0
>
> PicoLisp
> (reverse (mapcon '((X) (list (apply + X))) (reverse (mapcar '((X)
> (cond ((= X "{") 1) ((= X "}") -1) (T 0))) (chop "@{ foo; if (abc) {
> if (q) { m; } } }")) ) ))
> (0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 2 2 1 1 0)
>
>
> http://csilo.com/!article?2014/01/15/J-vs-Javascript-vs-PicoLisp-short-comparison
>
> On Fri, Jan 17, 2014 at 10:41 AM, Devon McCormick <[email protected]>
> wrote:
> > I'll be talking on J to a meetup here in New York this coming Tuesday -
> > http://www.meetup.com/7-Languages-in-7-Months-NYC/ - so I've been
> watching
> > the "fork examples" discussion w/some interest.
> >
> > I did a dry run of my talk at NYCJUG this past Tuesday and, at that
> time, I
> > was looking to build up to a final, mind-blowing example like the
> > Newton-Raphson iterator, but now am thinking that that's too "tricky" and
> > what I'd really like to do is go into detail on some simpler examples.
>  Joe
> > Bogner's interest in the parenthesis-nesting idiom reminded me of how
> > innovative the array approach still is, so I'm definitely using that one.
> >
> > David Lambert, who was at the NYCJUG meeting has also given me a couple
> of
> > good ideas since then but I'm interested in anyone else's favorite J
> idiom
> > - "Jems" as Dan would have it - that illustrate the usefulness of array
> > thinking.
> >
> > Thanks,
> >
> > Devon
> > --
> > Devon McCormick, CFA
> > ----------------------------------------------------------------------
> > 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

Reply via email to