Re: [stack] sweetening concatenative syntax

"Christopher Diggins" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Thu, Mar 6, 2008 at 6:12 PM, Stevan Apter <[email protected]> wrote:
> forget about the partial application case. what i want in my toolkit
> is a single combinator 'map' which takes an n-ary function and applies
> it to each of a list of length-n lists. not map1, map2, ... for each
> case. is that what's going on here? or does typing rule out having
> such a combinator?

It really has to do with how you structure your lists. In Cat this is
feasible if your list is a lists of functions.

define mapN { [apply] swap compose [quote] compose map }

[[1 2] [3 4] [5 6]] list [+] mapN => [[3][7][11]]
[[1] [2] [3] [4]] list [2 *] mapN => [[2][4][6][8]] //

Cat however has untyped lists, so there is some cheating going on at
the type-level, but this would be feasible with typed lists as well.

The only serious restriction here AFAICS is that your function has to
produce a single result even though it can consume n arguments.

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