Re: [stack] disallowing recursive definitions

"Christopher Diggins" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Tue, Mar 4, 2008 at 12:42 AM, zallambo <[email protected]> wrote:
> --- In [email protected], Don Groves <dgroves@...> wrote:
> >
> >
> > On Mar 3, 2008, at 19:16 , John Nowak wrote:
> >
> > >
> > > On Mar 3, 2008, at 3:50 PM, William Tanksley, Jr wrote:
> > >
> > >>> With a concatenative tail-call you're passing the stack as an
> > >>> argument. In other words, you pass the entire state of the program!
> > >>
> > >> Yes, this is how concatenative languages are modeled. That's how
> > >> *every* step in their execution is modeled, not just tail-calls or
> > >> calls. If this were a problem, concatenative languages would be
> > >> universally problematic, not merely problematic in the presence of
> > >> tail-calls.
> > >
> > > Indeed, and I'd argue that this is exactly why many people find stack-
> > > based languages universally problematic. They're taking issue with all
> > > of this state passing, although they phrase it like "I can't keep the
> > > stack in my head". Of course this isn't a problem in practice,
> > > particularly when you have type inference involved and can get a quick
> > > summary of what a function cares about, but it does seem to be the
> > > source of many negative first impressions.
> >
> > Also, there has never been a requirement to "keep it all in one's head,"
> > that's what comments are for. Commenting with stack diagrams is very
> > useful!
> >
> > I know "real programmers" don't comment but in these languages, they
> > should.
> > --
> > don
>
> If code isn't readable without stack diagrams, comments seem like a
> poor fix. Rather, there should be a way to make the code itself more
> transparent. I think lambda expressions are a good replacement for
> stack diagrams. They make the stack explicit and are often easier to
> read. Compare:
>
> #x y u v -- (x*u - y*v) (x*v + y*u)
> dup4 [swap] dip * bury * swap - bury * bury * +
>
> [x y u v] [x u * y v * - x v * y u * +] lambda

<shamelessplug>

Cat supports this notation as: \x.\y.\u.\v.[x u * y v * - x v * y u * +]

</shamelessplug>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.