--- Roger Hui <[EMAIL PROTECTED]> wrote:
> It would be amusing to implement J in JavaScript.
>
> From: Johannes Laire <[EMAIL PROTECTED]>
>
> > You can't run J in a browser, the only language suitable for
> > that is
> > JavaScript.
First I thought, hey, that's provocatively brilliant,
why wasn't it thought of earlier. But after a while I remembered
that I was actually discussing such concept called
"J JavaScript Edition" in February 2006. It was looked at
sceptically, but now I can say "If two clever people came
up with the same idea, it can't be wrong." An exerpt follows.
(In the wake of Schema J prototype, I may add that
JavaScript is based on Scheme in its design, but has
advantage of modern OOP syntax, ubiquitous, devoid of Schema
installation overhead.)
--- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> Date: Wed, 1 Feb 2006 07:14:26 -0800 (PST)
> From: Oleg Kobchenko <[EMAIL PROTECTED]>
> Subject: Re: J JavaScript Edition
>
> Library for BigInt in JavaScript already exists.
> Rationals -- could be found or adapted. But it's not
> the point. Those are higher order operations, which
> could be left out for later releases.
>
> I am talking multidimentional operations primarily,
> such as I gave in the example.
>
> But the main attraction is the ability to run instantly
> from any browser, on any computer.
>
> Because it's JavaScript, it could be developed very easily,
> because the environment in live. So you can debug, right
> in the browser, see all variables. You can change definitions
> right in the running system, on the fly.
>
> It's like SmallTalk. But even better, because SmallTalk
> does not work in every browser.
>
>
>
> > Are you talking about creating a library of multidimensional operations,
> > longints and rationals for Javascript?
> >
> >
> > --- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> >
> > > I visited your site recently and reasserted
> > > that you like writing little JavaScript programs.
> > >
> > > Here is a start. What do you think?
> > >
> > > * It's a great prototyping RAD tool.
> > >
> > > * It's application is embedding into cross-browser J system.
> > >
> > >
> > > //////////////////////////////////////////////////////
> > > // J: JavaScript Edition
> > >
> > > function ravel(y) { var z=copy(y,[]); z.shape=[size(y)]; return z; }
> > > function copy(y,z) { for (var i=y.length;i--;) z[i]=y[i]; return z; }
> > > function size(y) { return insert(mul, y.shape); }
> > > function insert(f,y) { var z=f.id; for (var i=y.length; i--;)z=f(y[i],
> > > z);
> > > return z;}
> > >
> > > function add(x,y) {return x+y;} add.id=0;
> > > function mul(x,y) {return x*y;} mul.id=1;
> > >
> > > //////////////////////////////////////////////////////
> > >
> > > insert(add,[1,2,3,4])
> > > 10
> > > insert(mul,[1,2,3,4])
> > > 24
> > >
> > > a=[0,1,2,3,4,5,6,7,8,9,10,11]
> > > a.shape=[3,4]
> > > size(a)
> > > 12
> > > b=ravel(a)
> > > 0,1,2,3,4,5,6,7,8,9,10,11
> > > size(b)
> > > 12
> > > b.shape
> > > 12
> > > b.shape.length
> > > 1
> > > a.shape.length
> > > 2
> > >
____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm