Home > Archive > APL > May 2006 > Progress towards 4th.CoSy
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Progress towards 4th.CoSy
|
|
| Bob Armstrong 2006-05-12, 9:56 pm |
| Since moving to 2500 meters up in Colorado last August , I'm now
finding time ( besides having to fight the nicotine nazis here who
helped make NYC not worth the effort to remain there . See
http://SoSy.com/home.htm#20060512 ) to make some significant progress
towards a next generation CoSy built from the FORTH up .
I've been working in a very new and mimimalist FORTH by Ron Aaron named
Reva ( hebrew for 1/4 ) running on both Windows and Linux . I've just
posted the first code which provides some real utility from the
perspective of someone used to working at the FORTH level . Namely , I
have reference counted character , integer and float lists in useful
form , tho still pretty naked , for someone with an APL headset . I've
uploaded some examples at http://cosy.com/CoSy/CoSy/UserManual.htm
which links to further information .
My interest is simplicity of expression so it is borrowing a lot from K
other than its syntax . It is purely lists of lists ( bushes ) with
modulo indexing so there are no notions of dimension per se , and
rather than scalar extension , shorter lists are just indexed ( modulo
) to the length of the longer . In a sense , the only multidimensional
function is "flip" which transposes 2 dimensions if they are
rectangular , ie , all items of second dimension are of the same length
..
At this point , I could use some help from people who really know how
to write an APL as to the best way to structure the overloading words
to bury all the type specific verbs and adverbs and implement
traditional APL infix . While I am aiming at a more word defined syntax
than traditional APL structure , I really need to see how it has been
done to see what I need to do .
I'm looking , for instance for a copy of Whitney's one page prototype
of J . And , of course to pick the brains of the brilliant like
Bernecky and Ryan . If Chapman's I-APL is available somewhere , that
might be useful to look at too . Since the whole system is going to be
open code up to a very high application level , I look forward to input
from others . Reva which really became pubic last summer has evolved
spectacularly because of contributions from a number of brilliant
FORTH/assembly programmers scattered around the globe . The system
provides and will provide an APL that is unique in being open and
easily customizable right to the assembly language level .
Anyway , I invite you to take a look at what I've done so far . I
apologize for the script being as messy and unsegmented as it is , but
this is the very earliest point at which it's useful and makes sense to
invite feedback .
| |
| Martin Neitzel 2006-05-13, 7:56 am |
| >I'm looking , for instance for a copy of Whitney's one page prototype
>of J .
Have fun, Martin
typedef char C;typedef long I;
typedef struct a{I t,r,d[3],p[2];}*A;
#define P printf
#define R return
#define V1(f) A f(w)A w;
#define V2(f) A f(a,w)A a,w;
#define DO(n,x) {I i=0,_n=(n);for(;i<_n;++i){x;}}
I *ma(n){R(I*)malloc(n*4);}mv(d,s,n)I *d,*s;{DO(n,d[i]=s[i]);}
tr(r,d)I *d;{I z=1;DO(r,z=z*d[i]);R z;}
A ga(t,r,d)I *d;{A z=(A)ma(5+tr(r,d));z->t=t,z->r=r,mv(z->d,d,r);R z;}
V1(iota){I n=*w->p;A z=ga(0,1,&n);DO(n,z->p[i]=i);R z;}
V2(plus){I r=w->r,*d=w->d,n=tr(r,d);A z=ga(0,r,d);
DO(n,z->p[i]=a->p[i]+w->p[i]);R z;}
V2(from){I r=w->r-1,*d=w->d+1,n=tr(r,d);
A z=ga(w->t,r,d);mv(z->p,w->p+(n**a->p),n);R z;}
V1(box){A z=ga(1,0,0);*z->p=(I)w;R z;}
V2(cat){I an=tr(a->r,a->d),wn=tr(w->r,w->d),n=an+wn;
A z=ga(w->t,1,&n);mv(z->p,a->p,an);mv(z->p+an,w->p,wn);R z;}
V2(find){}
V2(rsh){I r=a->r?*a->d:1,n=tr(r,a->p),wn=tr(w->r,w->d);
A z=ga(w->t,r,a->p);mv(z->p,w->p,wn=n>wn?wn:n);
if(n-=wn)mv(z->p+wn,z->p,n);R z;}
V1(sha){A z=ga(0,1,&w->r);mv(z->p,w->d,w->r);R z;}
V1(id){R w;}V1(size){A z=ga(0,0,0);*z->p=w->r?*w->d:1;R z;}
pi(i){P("%d ",i);}nl(){P("\n");}
pr(w)A w;{I r=w->r,*d=w->d,n=tr(r,d);DO(r,pi(d[i]));nl();
if(w->t)DO(n,P("< ");pr(w->p[i]))else DO(n,pi(w->p[i]));nl();}
C vt[]="+{~<#,";
A(*vd[])()={0,plus,from,find,0,rsh,cat},
(*vm[])()={0,id,size,iota,box,sha,0};
I st[26]; qp(a){R a>='a'&&a<='z';}qv(a){R a<'a';}
A ex(e)I *e;{I a=*e;
if(qp(a)){if(e[1]=='=')R st[a-'a']=ex(e+2);a= st[ a-'a'];}
R qv(a)?(*vm[a])(ex(e+1)):e[1]?(*vd[e[1]])(a,ex(e+2)):(A)a;}
noun(c){A z;if(c<'0'||c>'9')R 0;z=ga(0,0,0);*z->p=c-'0';R z;}
verb(c){I i=0;for(;vt[i];)if(vt[i++]==c)R i;R 0;}
I *wd(s)C *s;{I a,n=strlen(s),*e=ma(n+1);C c;
DO(n,e[i]=(a=noun(c=s[i]))?a:(a=verb(c))?a:c);e[n]=0;R e;}
main(){C s[99];while(gets(s))pr(ex(wd(s)));}
| |
| Randy MacDonald 2006-05-13, 7:56 am |
| "Bob Armstrong" <bob@cosy.com> wrote in news:1147492387.748542.237190
@d71g2000cwd.googlegroups.com:
> I'm looking , for instance for a copy of Whitney's one page prototype
> of J . And , of course to pick the brains of the brilliant like
> Bernecky and Ryan .
Am I being too precise in saying that this one page covered a _very
limited_ subset of J? I don't think so. Also, I'd be the first to use
"tenacious" for Bob, and I don't know this "Ryan" offhand, but
"brilliant?"... perhaps I'll wait and see.
--
-----------------------------------------------------------------------
|\/| Randy A MacDonald | APL: If you can say it, it's done.. (ram)
|/\| ramacd@nbnet.nb.ca |
|\ | |
BSc(Math) UNBF'83 Sapere Aude |If you cannot describe what you are doing
| as a process, you don't know what you're
| doing.
| - W. E. Deming
Natural Born APL'er | Demo website: http://156.34.82.41/
-------------------------------------------------(INTP)----{ gnat }-
| |
|
|
| Paul Chapman 2006-05-13, 6:56 pm |
| > http://www.math.uwaterloo.ca/apl_archives/apl/i-apl/
Missing from that is the DE source in which the actual interpreter is
written. Since DE is a FORTH-like language, it may be useful to Bob. Bob,
reply here if you want it. It is virtually comment-free, and no support is
offered. ;)
Cheers, Paul
| |
|
|
Bob Armstrong wrote:
> Reva which really became pubic last summer
Whoa! Is this really appropriate for c.l.a?
| |
| Bob Armstrong 2006-05-19, 6:56 pm |
| Huh ? The creation of a new open source APL based on everything I've
learned making and living in APL environments for 30 years not
appropriate for c.l.a ?
Martin , thanks for posting Whitney's J prototype page . Looks like his
code .
I've never done more that a few lines of C , but looking up a few
constructions , I conclude that Randy's right : the fragment is just a
bare outline of interpreting verbs and nouns with just a handful of
representitive functions . The open source for A+ I think has a lot
more meat .
Jim Ryan wrote the APL for Boroughs . He signs himself taliesin or
something like that .
I'm not sure how much I can glean from the i-apl files . Time warp to
see those "ax"s and "bx"s instead of "eax"s and "ebx"s .Paul , I'm not
sure from your note whether it's the DE source or the i-apl
interpreter in DE or both which you have separately . It probably would
be nice to have them in a public archive somewhere .
The UNIX APL-ll source has been as useful as anything I've looked at .
But really , I'm going my own way . My current thoughts are that rather
than having tables of nouns , verbs , adverbs , I'll essentially have
dumb words and smart words , and numbers . Dumb words , data items ,
will just stack themselves ; numbers will get interpreted and formed
into data items ; and smart words will execute upon encountering and
look around to see what types of words are on either side of them to
determine what they should do . The end result will be pretty much
infix very much like traditional APL ( not J or K ) , but with
word-definition centered rather than table driven syntax . I should be
able to see within a few w s whether this will work .
| |
|
|
"bwo" <brian.w.oliver@gmail.com> wrote in message news:1147810446.702032.162820@g10g2000cwb.googlegroups.com...
>
> Bob Armstrong wrote:
>
> Whoa! Is this really appropriate for c.l.a?
>
of course it is. bob is turning years of critical
thinking about APL into a new array language.
it must be that bracing colorado air (or the tobacco
smoke suspended therein.)
|
|
|
|
|