Christopher Diggins | 10 Feb 2008 07:37
Picon
Gravatar

[stack] Cat article submission to Doctor Dobbs Journal

First let me say, I really *really* appreciate all the feedback I have
had on my past articles on Cat. So far all my article submissions have
been rejected. :-(

I submitted three different articles to International Conference of
Functional Programming (ICFP), Compiler Construction (CC), Programming
Language Design and Implementation (PLDI) ). These are high-end
conferences with high-rejection rates. In retrospect they were out of
my league, but I did have helpful reviews. Overall the reviews were
encouraging, but were clear on the fact that I had a lot of work to
do, and that I wasn't yet ready to play in the big leagues. I plan on
incorporating the review feedback and resubmitting to an appropriate
workshop or symposium.

For the time being I have been contracted to provide Doctor Dobbs with
an article about Cat. I talk quite a bit about Joy and concatenative
languages in general. It is due Monday, but if anyone has time to
share comments or suggestions before then I would be most
appreciative. I have put a draft of the article online at
http://docs.google.com/Doc?id=dgjz7z25_58f4zzg8dz . If I make any big
mistakes, or inaccuracies, or I am unfair I apologize in advance.
Please let me know so that I can correct it. I will have a chance to
make small changes to the galley proof before the article goes to the
printer.

Hopefully this will help give a bit more mainstream recognition to the
benefits of concatenative languages!

Thanks,
Christopher

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Need traffic?

Drive customers

With search ads

on Yahoo!

Yahoo! Groups

How-To Zone

Do-It-Yourselfers

Connect & share.

.

__,_._,___
William Tanksley, Jr | 10 Feb 2008 08:19
Picon

Re: [stack] Cat article submission to Doctor Dobbs Journal

> For the time being I have been contracted to provide Doctor Dobbs with
> an article about Cat. I talk quite a bit about Joy and concatenative
> languages in general. It is due Monday, but if anyone has time to

Congrats! Tell me which month so I can read it in print!

Some notes:

What is the [?] in "...very easy to create efficient implementations for [?],"?

The phrase "upon which Manfred von Thun, based the Joy language"
shouldn't have a comma.

Now I find a real disagreement. First-class functions aren't at all
part of the definition of "concatenative", nor are branch statements
antithetical to concatenativity. Manfred's major innovation was to
introduce and extensively use function literals, which are similar to
lambdas in other functional languages; this innovation allowed Joy to
be analyzed in much the same way as other functional languages. I'd
really appreciate it if you'd alter this part of the article, if at
all possible; the definition of "concatenative" may not be perfect,
but it's FAR sharper than this. A possible replacement:

"Manfred's primary innovation with Joy was to introduce first class
functions and function literals (called quotations). The resulting
language shares many of the advantages of functional languages (e.g.
it is easy to reason about) and is particularly expressive."

Unfortunately, this removes all mention of "concatenative" from your
article, but since you didn't really discuss it I don't think it's a
loss. I do think you could be more precise than "is particularly
expressive", though... I'm not sure what you mean by it, although it
looks like a compliment :-).

Minor style note: "using the higher-order functions apply, if, while,
etc." Using "etc" is not optimal; try "using higher-order functions
such as apply, if, and while."

...I just got handed the baby. No more time! :-)

-Wm

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

New web site?

Drive traffic now.

Get your business

on Yahoo! search.

Yahoo! Groups

Special K Challenge

Join others who

are losing pounds.

.

__,_._,___
Christopher Diggins | 10 Feb 2008 08:55
Picon
Gravatar

Re: [stack] Cat article submission to Doctor Dobbs Journal

Hi William,

Thanks. I've responded to your comments below and already started
tweaking the article as per your suggestions.

On Feb 10, 2008 2:19 AM, William Tanksley, Jr <wtanksleyjr <at> gmail.com> wrote:
> > For the time being I have been contracted to provide Doctor Dobbs with
> > an article about Cat. I talk quite a bit about Joy and concatenative
> > languages in general. It is due Monday, but if anyone has time to
>
> Congrats!

Thanks.

> Tell me which month so I can read it in print!

I can't say yet, I'll let you know as soon as I know.

> Some notes:
>
> What is the [?] in "...very easy to create efficient implementations for
> [?],"?

Reference place holders. Changed it to [ref]

> The phrase "upon which Manfred von Thun, based the Joy language"
> shouldn't have a comma.
>
> Now I find a real disagreement. First-class functions aren't at all
> part of the definition of "concatenative"

My bad, I didn't mean to imply that. They are key to why Joy is so
interesting (to me at least) though.

> nor are branch statements
> antithetical to concatenativity.

I really didn't mean to imply that one neither. My point was that the
fact that Manfred leaving branch statements (by which I mean goto
statements) out was significant (is that contentious?). I wasnt trying
to say anything there about concatenative languages in general. I've
tried to clarify.

>Manfred's major innovation was to
> introduce and extensively use function literals, which are similar to
> lambdas in other functional languages; this innovation allowed Joy to
> be analyzed in much the same way as other functional languages. I'd
> really appreciate it if you'd alter this part of the article, if at
> all possible; the definition of "concatenative" may not be perfect,
> but it's FAR sharper than this.
>
> A possible replacement:
>
> "Manfred's primary innovation with Joy was to introduce first class
> functions and function literals (called quotations). The resulting
> language shares many of the advantages of functional languages (e.g.
> it is easy to reason about) and is particularly expressive."

I like that, but the goto removal is significant, and should be left
because with gotos you wouldn't have the nice rewriting properties
that you have now.

> Unfortunately, this removes all mention of "concatenative" from your
> article, but since you didn't really discuss it I don't think it's a
> loss. I do think you could be more precise than "is particularly
> expressive", though... I'm not sure what you mean by it, although it
> looks like a compliment :-).

By expressive I meant that we can say a lot with a little. (e.g. a few
instructions can convey a sophisticated concept). I've tried to
rephrase.

> Minor style note: "using the higher-order functions apply, if, while,
> etc." Using "etc" is not optimal; try "using higher-order functions
> such as apply, if, and while."

Good point.

> ...I just got handed the baby. No more time! :-)
>
> -Wm

I look forward to more of your comments, thanks!

Gotta go to bed now,
- Christopher

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Find helpful tips

for Moderators

on the Yahoo!

Groups team blog.

Special K Group

on Yahoo! Groups

Learn how others

are losing pounds.

.

__,_._,___
William Tanksley, Jr | 10 Feb 2008 18:25
Picon

Re: [stack] Cat article submission to Doctor Dobbs Journal

Christopher Diggins <cdiggins <at> gmail.com> wrote:
> > Now I find a real disagreement. First-class functions aren't at all
> > part of the definition of "concatenative"

> My bad, I didn't mean to imply that. They are key to why Joy is so
> interesting (to me at least) though.

Definitely. You're right that they belong in the intro.

> > nor are branch statements
> > antithetical to concatenativity.

> I really didn't mean to imply that one neither. My point was that the
> fact that Manfred leaving branch statements (by which I mean goto
> statements) out was significant (is that contentious?). I wasnt trying
> to say anything there about concatenative languages in general. I've
> tried to clarify.

What previous concatenative language had GOTO statements? I don't
think Manfred "left them out"... They're a little hard to put in, so
they were rare at best in other concatenative languages. I assumed you
were talking about special syntax for conditionals, which Manfred
removed the need for when he supplied function literals.

> > A possible replacement:

> > "Manfred's primary innovation with Joy was to introduce first class
> > functions and function literals (called quotations). The resulting
> > language shares many of the advantages of functional languages (e.g.
> > it is easy to reason about) and is particularly expressive."

> I like that, but the goto removal is significant, and should be left
> because with gotos you wouldn't have the nice rewriting properties
> that you have now.

Good point... But that's because of the removal of syntax (or the
regularization of syntax), not so much because of the removal of GOTOs
(which are merely a particular type of syntax, and one which most
concatenative languages don't have anyhow).

> > Unfortunately, this removes all mention of "concatenative" from your
> > article, but since you didn't really discuss it I don't think it's a
> > loss. I do think you could be more precise than "is particularly
> > expressive", though... I'm not sure what you mean by it, although it
> > looks like a compliment :-).

> By expressive I meant that we can say a lot with a little. (e.g. a few
> instructions can convey a sophisticated concept). I've tried to
> rephrase.

Cool.

> I look forward to more of your comments, thanks!

Having skimmed the rest, I like what you have from there on... I could
hunt for more nits to pick, but don't have the time and might not find
any anyhow.

> - Christopher

-Wm

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Need traffic?

Drive customers

With search ads

on Yahoo!

Yahoo! Groups

Lawn & Garden

ideas and tips

for a green thumb.

.

__,_._,___
Christopher Diggins | 10 Feb 2008 19:15
Picon
Gravatar

Re: [stack] Cat article submission to Doctor Dobbs Journal

On Feb 10, 2008 12:25 PM, William Tanksley, Jr <wtanksleyjr <at> gmail.com> wrote:
> Christopher Diggins <cdiggins <at> gmail.com> wrote:
> > > Now I find a real disagreement. First-class functions aren't at all
> > > part of the definition of "concatenative"
>
> > My bad, I didn't mean to imply that. They are key to why Joy is so
> > interesting (to me at least) though.
>
> Definitely. You're right that they belong in the intro.
>
>
> > > nor are branch statements
> > > antithetical to concatenativity.
>
> > I really didn't mean to imply that one neither. My point was that the
> > fact that Manfred leaving branch statements (by which I mean goto
> > statements) out was significant (is that contentious?). I wasnt trying
> > to say anything there about concatenative languages in general. I've
> > tried to clarify.
>
> What previous concatenative language had GOTO statements?

Forth has BRANCH and BRANCH? Do you consider Forth a concatenative
language? Either way I am talking explicitly about stack-based
languages so Forth definitely has to be considered.

> I don't
> think Manfred "left them out"... They're a little hard to put in, so
> they were rare at best in other concatenative languages. I assumed you
> were talking about special syntax for conditionals, which Manfred
> removed the need for when he supplied function literals.

I consider conditionals (and other control flow constructs) as simply
syntactic sugar for branch statements. However, I will try to make it
less contentious, and my intention more clear.

> > > A possible replacement:
>
> > > "Manfred's primary innovation with Joy was to introduce first class
> > > functions and function literals (called quotations). The resulting
> > > language shares many of the advantages of functional languages (e.g.
> > > it is easy to reason about) and is particularly expressive."
>
> > I like that, but the goto removal is significant, and should be left
> > because with gotos you wouldn't have the nice rewriting properties
> > that you have now.
>
> Good point... But that's because of the removal of syntax (or the
> regularization of syntax), not so much because of the removal of GOTOs
> (which are merely a particular type of syntax, and one which most
> concatenative languages don't have anyhow).

You keep saying concatenative languages, and I am talking about
stack-based languages. I am still not sure which languages are
technically concatenative (is Forth? is JVML? is PostScript?). I am
referring to things like MSIL, JVML, and Forth all of which have
explicit gotos (i.e. branches / jumps / conditionals / etc.).
Historically branching is part of stack
languages, because they lacked higher-order functions. However
PostScript breaks this rule, and I am concerned that I may be beging
inaccurate when we consider it. It seems that PostScript does have a
notion of function literals before Joy, so I have to be careful how I
refer to the contributions of Joy.

> > > Unfortunately, this removes all mention of "concatenative" from your
> > > article, but since you didn't really discuss it I don't think it's a
> > > loss. I do think you could be more precise than "is particularly
> > > expressive", though... I'm not sure what you mean by it, although it
> > > looks like a compliment :-).
>
> > By expressive I meant that we can say a lot with a little. (e.g. a few
> > instructions can convey a sophisticated concept). I've tried to
> > rephrase.
>
> Cool.
>
>
> > I look forward to more of your comments, thanks!
>
> Having skimmed the rest, I like what you have from there on... I could
> hunt for more nits to pick, but don't have the time and might not find
> any anyhow.

Thank you very much!!

- Christopher

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Search Ads

Get new customers.

List your web site

in Yahoo! Search.

Y! Groups blog

The place to go

to stay informed

on Groups news!

.

__,_._,___
Stevan Apter | 10 Feb 2008 19:38

Re: [stack] Cat article submission to Doctor Dobbs Journal

chris:

> You keep saying concatenative languages, and I am talking about
> stack-based languages. I am still not sure which languages are
> technically concatenative (is Forth? is JVML? is PostScript?).

i've been up and down this road so many times i'm giving names to
the rocks. am i wrong in thinking that the languages we're
concerned with (in this group) are those in which wholes are built
from parts by concatenation and where concatenation denotes a
fundamental operation, either composition or application (or
something else)?

joy and its descendents satisfy that definition. other languages
can be restricted in various ways to satisfy it.

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Y! Groups blog

The place to go

to stay informed

on Groups news!

Lawn & Garden

on Yahoo! Groups

For all things

green and growing.

.

__,_._,___
Christopher Diggins | 10 Feb 2008 20:00
Picon
Gravatar

Re: [stack] Cat article submission to Doctor Dobbs Journal

On Feb 10, 2008 1:38 PM, Stevan Apter <sa <at> nsl.com> wrote:
> chris:
>
>
> > You keep saying concatenative languages, and I am talking about
> > stack-based languages. I am still not sure which languages are
> > technically concatenative (is Forth? is JVML? is PostScript?).
>
> i've been up and down this road so many times i'm giving names to
> the rocks. am i wrong in thinking that the languages we're
> concerned with (in this group) are those in which wholes are built
> from parts by concatenation and where concatenation denotes a
> fundamental operation, either composition or application (or
> something else)?
>
> joy and its descendents satisfy that definition. other languages
> can be restricted in various ways to satisfy it.

Hi Stevan,

This seems more or less like the definition that majority of the group
has agreed upon. In your opinion what languages other than Joy does it
include?

- Christopher

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Groups

w/ John McEnroe

Join the All-Bran

Day 10 Club.

Cat Groups

on Yahoo! Groups

Share pictures &

stories about cats.

.

__,_._,___
Stevan Apter | 10 Feb 2008 20:23

Re: [stack] Cat article submission to Doctor Dobbs Journal


----- Original Message -----
From: "Christopher Diggins" <cdiggins <at> gmail.com>
To: <concatenative <at> yahoogroups.com>
Sent: Sunday, February 10, 2008 2:00 PM
Subject: Re: [stack] Cat article submission to Doctor Dobbs Journal

> On Feb 10, 2008 1:38 PM, Stevan Apter <sa <at> nsl.com> wrote:
>> chris:
>>
>>
>> > You keep saying concatenative languages, and I am talking about
>> > stack-based languages. I am still not sure which languages are
>> > technically concatenative (is Forth? is JVML? is PostScript?).
>>
>> i've been up and down this road so many times i'm giving names to
>> the rocks. am i wrong in thinking that the languages we're
>> concerned with (in this group) are those in which wholes are built
>> from parts by concatenation and where concatenation denotes a
>> fundamental operation, either composition or application (or
>> something else)?
>>
>> joy and its descendents satisfy that definition. other languages
>> can be restricted in various ways to satisfy it.
>
> Hi Stevan,
>
> This seems more or less like the definition that majority of the group
> has agreed upon. In your opinion what languages other than Joy does it
> include?

just a guess -- billy will correct me if i'm wrong: the tacit part
of J (application), point-free haskell, one (or more?) of jot/zot/iota,
chris okasaki's flattened combinator language, lee spector's PUSH,
van Oormerssen's False. i'm still not sure in what sense or under
what restrictions Forth or Postscript satisfy the definition. it
would be good to be able to answer the question "is this language
concatenative, and if not, why not?"

>
> - Christopher
>

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Ads on Yahoo!

Learn more now.

Reach customers

searching for you.

Find helpful tips

for Moderators

on the Yahoo!

Groups team blog.

.

__,_._,___
Christopher Diggins | 10 Feb 2008 22:48
Picon
Gravatar

Re: [stack] Cat article submission to Doctor Dobbs Journal

On Feb 10, 2008 2:23 PM, Stevan Apter <sa <at> nsl.com> wrote:
> ----- Original Message -----
> From: "Christopher Diggins" <cdiggins <at> gmail.com>
> To: <concatenative <at> yahoogroups.com>
> Sent: Sunday, February 10, 2008 2:00 PM
> Subject: Re: [stack] Cat article submission to Doctor Dobbs Journal
>
> > On Feb 10, 2008 1:38 PM, Stevan Apter <sa <at> nsl.com> wrote:
> >> chris:
> >> > You keep saying concatenative languages, and I am talking about
> >> > stack-based languages. I am still not sure which languages are
> >> > technically concatenative (is Forth? is JVML? is PostScript?).
> >>
> >> i've been up and down this road so many times i'm giving names to
> >> the rocks. am i wrong in thinking that the languages we're
> >> concerned with (in this group) are those in which wholes are built
> >> from parts by concatenation and where concatenation denotes a
> >> fundamental operation, either composition or application (or
> >> something else)?
> >>
> >> joy and its descendents satisfy that definition. other languages
> >> can be restricted in various ways to satisfy it.
> >
> > Hi Stevan,
> >
> > This seems more or less like the definition that majority of the group
> > has agreed upon. In your opinion what languages other than Joy does it
> > include?
>
> just a guess -- billy will correct me if i'm wrong: the tacit part
> of J (application), point-free haskell, one (or more?) of jot/zot/iota,
> chris okasaki's flattened combinator language, lee spector's PUSH,
> van Oormerssen's False.

This is a pretty good list, thank you! You left out XY.

> i'm still not sure in what sense or under
> what restrictions Forth or Postscript satisfy the definition.

Yeah, that's the tricky part. I believe there are valid phrases in
Forth which can't be concatenated (and/or split) to create other valid
phrases (e.g. using BRANCH). I don't know about PostScript.

> it
> would be good to be able to answer the question "is this language
> concatenative, and if not, why not?"

Yes, I agree. Having a laundry list of concatenative languages is a
good first step though I think. At least we can compare other
languages to the existing list, and state what the characteristics it
shares and

On another topic I was reviewing PostScript and your interview with
Manfred (thanks for doing that and sharing it by the way, I love
getting into Manfred's mind) and I found this quote:
"What distinguishes Joy from (the functional subsets of) Forth and
Postscript is the datatype of quoted programs". Well in PostScript
there appears to be quoted programs, they are just called executable
arrays. However, there are no *literal* quotations. Rather there are
operators for constructing quoted programs (i.e. "{" and "}"). A
somewhat pedantic difference but one worth noting I think. I've
udpated the introduction of my article a bit to reflect this
observation. Does anyone agree/disagree?

On another topic I wonder if in PostScript you can write:

\f { { } def
\g { } } def

This would possibly break concatenativity.

- Christopher

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Find helpful tips

for Moderators

on the Yahoo!

Groups team blog.

New business?

Get new customers.

List your web site

in Yahoo! Search.

.

__,_._,___
John Nowak | 11 Feb 2008 02:40
Gravatar

[stack] Re: Cat article submission to Doctor Dobbs Journal

I'll be quick here, as I haven't the time I wish I had.

The introduction seems weak. Simplicity doesn't come from a low number
of concepts. If it did, the SK-calculus would be the language all new
programmers would be starting with. It seems like offering a hook
beyond how "simple" it is should be part of your introduction. There
is the discussion of efficiency, but at least for me, this is one of
the least interesting parts about Cat. That said, I'm not sure how I'd
rework this...

> In the Cat specification instructions are referred to as functions,
> whether or not they have side-effects.

Do functions actually have side-effects? If all functions are unary
functions of stacks to stacks, it's easy to thread an implicit world
state through the entire program. I believe Backus's FL did something
similar. As far as I'm concerned, Cat is purely functional. Functions
of the type A ~> B are functions that read/write the world state on
the top of the stack. All other operations work below it.

> Functions can not be redefined, and are only visible after they are
> defined.

Does this mean recursive definitions are disallowed?

> In Joy parlance this is called a quotation, but I prefer to think of
> it as either an anonymous function or lambda expression.

Lambda expression might not be the term to use here as there are no
variables involved.

> A possible definition of bin_rec is shown Figure X.

So bin_rec must be a primitive? If so, that should probably be stated.
I assume that's the case for reasons related to the type system, as I
believe you can write it in Joy.

> For those who like big Greek words

I don't know who the intended audience of this is (I'm not familiar
with Doctor Dobbs), but I find this level of informality off-putting.

> Metadata is a form of structured comment that can be associated with
> a Cat program. I use it to document functions, and provide automatic
> unit tests.

Again, not sure on the audience, but "I use it" as opposed to "Its
intended use is" strikes me as odd.

> Static type systems are useful for documentation, static
> verification of code, and optimization.

And more!

> It is common practice in stack languages to document the stack
> effects of each instruction, i.e. what type of values are remove
> from the stack (the consumption), and what type of values are placed
> on the stack (the production).

That should be 'e.g.', not 'i.e.'.

> If the type annotation is omitted, Cat is able to infer the type
> automatically, using a variant of the Hindley-Milner algorithm [X]

Should be: "If a type annotation is omitted, Cat is able to infer a
type automatically using a variant of the Hindley-Milner algorithm [X]."

> Using the Cat interpreter "#t" will give you the type of any
> function on the stack.

I don't quite understand this sentence. Perhaps "Using '#t' in the Cat
interpreter"?

> The most important properties are: whether the required input types
> for a function are being supplied when it is called

Perhaps "values of the correct types" is better.

> A somewhat novel feature of the Cat type system is that all
> functions are row polymorphic [ref] (also called tail polymorphic)

I don't have time to get into this now, but I think there are cases
when you don't want functions to be row polymorphic. A trivial
example: Supplying a function that takes two arguments for use in a
callback. Simply requiring the function to unify with (A b c -> A)
would be insufficient, as you'd be allowed to pass something like (A b
c d e -> A b). I've had to introduce an additional concept to my type
system to address this. First-class stacks (evaluated on via Joy's
'infra') also seem to require this. I'll post in more detail soon I'm
sure...

> define quadratic { [dupd [sqr] dip swap [*] dip] dipd [* +] dip + }

If you take the arguments in reverse order, as you typically would,
you can do this:

2dup [* * swap] dip * + +

> Now we partially evaluate the "papply" functions:

Better than 'curry'. :)

Anyway, I hope something in there helped. Sorry I don't have time for
a more thorough reading.

- John

__._,_.___
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

New web site?

Drive traffic now.

Get your business

on Yahoo! search.

Yahoo! Groups

Wellness Spot

A resource for Curves

and weight loss.

.

__,_._,___

Gmane