Re: [stack] Meta-combinators?

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
Christopher Diggins <[email protected]> wrote:
> > The obvious implementation, in terms of Joy quotations, would be to
> > concatenate the original function with a stack shuffle that destroys
> > the appropriate output.

> So the solution is simple in Cat (and Joy as well) to this case:

> In Cat "[quote] dip compose"
> And in Joy: "[unit] dip cat"

> What I am looking for though is something which curries all of the
> consumed arguments, or pops all the produced results.

All at once? From a naked stack? I don't like that. It's a variable
stack effect. If you pulled them out of a list I'd be happier.
Variable stack effects make me uncomfortable.

> The more general problem is how to construct a combinator which can
> curry all arguments for any given function. Stated differently the
> challenge is to write a function which can compute the number of
> arguments or number of results of any given function.

The same function can compute whether and when the given function
halts -- consider a function that consists of a loop, each iteration
of which places an integer on the stack. Knowing how many integers it
produces is equivalent to knowing how many iterations it performs.

(If we limit ourself to nonvariable stack effects the problem is
simple -- but it's EASY to build a function with variable effects;
recursion and conditionals are sufficient, unless you have a type
system with special rules.)

> > > The producer transforms any function into a new function which
> > > consumes nothing, but produces the result as if it was fed the stack
> > > configuration when it was created.

> > > Production is like a generalized form of currying.

> > So you'd prepend the input data value onto (a copy of) the input function.

> Yes.

> > > How would this be possible in the general case in Joy? Or Factor, or
> > > any other concatenative language for that matter?

> > Currying is equivalent to concatenation.

> Yes.

It's not possible in Joy, because Joy doesn't have a type system.

> P.S. Let me know when you have a chance to review the Cat paper
> (http://www.cat-language.com/paper.html). I am considering submitting
> it (with revisisons) to the upcopming Trends in Functional Programming
> symposium (deadline is February 1st.)

Ouch! I can't do it. Sorry. I've got two huge work deadlines and am
recovering from the stomach flu. I'll print it out to read on the
train home today, but no promises... I'm working on 1 hour of sleep,
and you might not be able to use what I produce :-).

> http://www.cdiggins.com

-Billy
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.