[Jprogramming] @: and capped fork
Stefano Lanzavecchia
stf at apl.it
Mon Dec 3 18:42:44 UTC 2012
The proposed Javascript is more along the lines of: execute a function
(do_something) on the value of each (for (var prop)) of the variabiles
contained in a specified locale (a).
So, a literal translation would involve the retrieval of the list of the
variable names (b and c in the exampple, but it could be anything, including
an empty list) defined in the locale "a", the extraction of their values.
In a relatively recent version of Dyalog APL (sorry I can't do it in J) you
could write:
a<-[]NS ''
a.b<-'bee'
a.c<-'see'
do_something each a.(execute each []nl -2)
where "<-" stands for the left-arrow assignement, "[]" for the "quad"
symbol, "each" and "execute" for the primitives with the said name.
--
Stefano
> -----Original Message-----
> From: programming-bounces at forums.jsoftware.com [mailto:programming-
> bounces at forums.jsoftware.com] On Behalf Of Devon McCormick
> Sent: Monday, December 03, 2012 7:32 PM
> To: J-programming forum
> Subject: Re: [Jprogramming] @: and capped fork
>
> I'm sure I don't understand the Javascript-specific nuances of your
question,
> but is a J version much different than this?
>
> do_something"0 a=. 'bee';'see'
>
>
>
> On Mon, Dec 3, 2012 at 1:09 PM, Alex Giannakopoulos
> <aegean at blueyonder.co.uk
> > wrote:
>
> > On 3 December 2012 15:59, Raul Miller <rauldmiller at gmail.com> wrote:
> >
> > > That said, when I want to translate J into a language other people
> > > understand, Javascript is usually my first choice.
> > >
> >
> > Why does that not surprise me? :-)
> >
> >
> > Incidentally, and if you have nothing better to do, how would you code
> > this Javascript into J?
> > a = new Object();
> > a.b = "bee";
> > a.c = "see";
> > for (var prop in a)
> > do_something(a[prop]) ;
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
>
> --
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list