Re: [stack] Meta-combinators?

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
Christopher Diggins <[email protected]> wrote:
> I have been intrigued by two typed-combinators which I haven't noticed
> in Joy, and that I am considering adding to Cat.
> I am calling them producer and consumer.

> consumer : (('A -> 'B) -> ('A -> ))
> producer : ('A ('A -> 'B) -> 'A ( -> 'B))

> The consumer transforms any function into a new function which
> produces nothing, but consumes what was expected.

A more general form might be a word that "consumes" only the first
argument of a multiargument function, ala:

 consumer : ('A -> B 'C) -> ('A -> 'C))

(I hope I got your notation right. I'm also not particular on which
side of the function the arguments get consumed.)

The obvious implementation, in terms of Joy quotations, would be to
concatenate the original function with a stack shuffle that destroys
the appropriate output.

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

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

> Christopher

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