On Tuesday, May 26, 2015 at 3:37:16 AM UTC-5, luserdroog wrote:
> On Monday, May 25, 2015 at 1:04:39 PM UTC-5, Lobachevsky wrote:
> > Have a look at Timothy Budd's book, An APL Compiler. In Chapter 6, Structural Functions, he talks about "stepper values" for transpose, take, drop, and reverse.
>
> Thanks. Added to cart.
>
Alright, it arrived and I'm up to chapter 6 and there
are some amazing ideas here. And an added point of
interest is frequent mention of a paper co-authored
by a certain Douglas Wyatt who co-authored a certain
paper with a certain John Warnock which described
what became known as the Adobe Image Model. So I
definitely perked up when I saw that name. :)
I think a lot (possibly most) of the ideas can be
applied to an interpreter. But I don't if I really
have the chops to design and build such a monster.
My own efforts have resulted in a C demo of Inner
Product using "dope vectors" which Budd describes in
chapter 4 as "extension vectors" with a note that
they're also sometimes called "power vectors" and
there's no real standard nomenclature here.
Linked elsethread.
Having done that, I decided to check my work and
go back to A Programming Language and rereread the
chapter on representations where he describes several
options for representation of vectors where the
version I've implemented corresponds most closely
to the Linear representation. But other tantalizing
choices are Chained and Partitioned.
With a chained vector, each element is in a node
structure which also contains a pointer to the next
element (duh), but the "pointer" can be any kind of
variable-sized variable-based numerical entity (which
of course, we knew, but this observation I think is far
less deserving of 'duh').
With a partitioned vector, elements are "typed-out"
linearly with sentinel values (called "partition
symbols"). This mostly closely models the final printed
appearance of an array, except for extra padding (but you
could do that if you want to).
So, now I want to build a structure that can have a
variable representation. At first a language could
be implemented by always converting arguments to a
convenient type for each function's algorithm. Later,
algortihms for all representations can be written,
profiled, and then more powerful strategies for rep-
coercion could be devised (or so I pipe-dream).
Incorporating this with some magical JIT tech and you
could compile each line before executing (duh).
So, I kind of want to go back to my Lisp interpreter
code and build-up my compiler chops. I'll be sure to
report any results pertinent to APL implementation.