Re: [stack] Abstracting away the complexity is the goal.

"William Tanksley, Jr" <[email protected]> Wed, 24 Feb 2010 08:13:27 -0800
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
stevan apter <[email protected]> wrote:

> my first implementation was 01.k.  then you or kerby observed that 10
> had the nice property that distinct programs had distinct representations
> as binary numbers.  hence 10.k.


I admit I was joking about your motives; as a stack languages programmer I'm
MORE vulnerable to the charge that I enjoy reading things backwards than any
APL programmer would be. (By the way, to those who don't know APL -- it
executes generally right-to-left, but it's actually read left to right. The
result is surprisingly pleasant, once you learn to pronounce the glyphs; I
could once read 'em, but I can't write 'em. K, J, and Q are more modern
languages that have the same characteristics, but without the non-ASCII
glyphs.)

It was probably me who claimed that; the problem is (like many things I
claim and Kerby didn't comment on) that it's not guaranteed to be true. It's
unlikely that a program will start with an execution combinator, especially
when the executor includes a 'drop' (as my suggestion for a basis did); but
it's possible, since after all the goal combinator may well drop and execute
that exact stack effect. I spent a while using that notation, but it became
unusable once I started trying random bases.

For my current version of tworing/zeroone, I've adopted the convention that
programs are always represented as positive integers, whose leading 1-bit in
binary notation is silently discarded. Thus, '1' is the empty program, and
the others follow from there. (My superoptimizer actually keeps track of the
length, rather than performing a log-base-2 every time I want to check a
program; but that's a minor detail.)

The results are reasonably pleasant. If you're into that kind of thing. :-)

-Wm


[Non-text portions of this message have been removed]