Re: [stack] array theory question
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Dec 22, 2008, at 7:18 PM, John Cowan wrote:
> Backing off to your underlying issue, there is no problem with either
> identifying tuples of size 1 with scalars in languages that have
> tuples,
> or not doing so. ML, Haskell, and Pure do: Python and Q don't.
You are correct here. The issue is that I want to do it with lists/
arrays of arbitrary length, not tuples. In other words, I'd like this
to work, where '&' is a psuedo partial application and ':' is
application:
(add2 & 2) : 3 ==> 5
(add3 & 2) : {3, 4} ==> 9
The question here is what the semantics of '&' are. In the former, it
appears to be as such where '++' is 'cons':
(f & x) : y == f : (x ++ (y ++ {}))
In the latter however, the enlisting of the argument on the right side
of the application is not necessary as it is already a list:
(f & x) : {y, z} == f : (x ++ {y, z})
What I'm hoping might make sense here is making the atom 'y'
equivalent to '{y}'. This would allow the second form of '&' shown
above to be used in the general case. Do you think that may be
workable? Is it comparable to what Nial or APL do?
Thanks for the help.
- John