[stack] function "adjoinment"?
John Nowak <[email protected]> Sun, 31 Jan 2010 18:22:17 -0500
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
We're familiar with the notion of function composition:
(a -> b) -> (b -> c) -> (a -> c)
However, is anyone familiar with a notion of function "adjoinment"?
Given a function F that takes a tuple A to a tuple B, and a function G
that takes a tuple C to a tuple D, the adjoinment of F and G would be
a function that takes the concatenation of A and B to the
concatenation of C and D. In other words:
(a -> b) -> (c -> d) -> (a++b -> c++d)
where ++ is concatenation and a,b,c,d are tuples/stacks
Such an operation would be equivalent to a smart variant of the
"spread" combinator in Factor where each function provided would be
automatically "aligned" with its input. For example, if curly braces
are the adjoinment operation, the following equality holds:
{sq, +} == + [sq] dip == [sq] 2dip +
In order for this to work, each function would have to have an arity
of the form N -> M where N and M are natural numbers; it's not clear
how this could be extended to functions of variable arities (e.g.
"clear" or "dip"), but that's not an issue for my purposes.
This is not a proposal. I'm mainly curious if anyone is familiar with
a formal treatment of such an operation.
- jn