Re: [stack] Why is point-free form so interesting?
"William Tanksley, Jr" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
stevan apter <[email protected]> wrote: > From: "William Tanksley, Jr" <[email protected]> > > stevan apter <[email protected]> wrote: > > > a list has an order but you can ignore it. > > Yes, but iteration over a list is ordered. That's the sort of minor > > distinction that can wind up making a difference in a heavy > > computation; especially since we're talking about a notation that's > > supposed to clearly express the idea of unordered dataflows. > so then use association arrays or the equivalent, which cannot > be accessed by position, only by name or the equivalent. (of > course any implementation will order the symbol-value pairs in > some way, but who cares?) I suspect that this enters the realm of implementation details, about which I don't think I'm concerned at the moment. I believe that I'm actually worried about semantics. And an idea has finally broken through to me. I'm going to stop talking about multisets or data structures and just talk about semantics. What I actually want is the ability to declare that a number of data items should appear as one for all stack shuffling and data processing purposes -- yet they should both be processed. Let's consider the simplest case, where we have two items. This implies that semantically, the program behaves as though a new process was spawned with the same stack as the parent EXCEPT the second-to-top item, while the parent stack is missing the top item. Practically, one probably wouldn't want to implement things that way (I hope that most of the time the stack duplication and the thread creation would be optimized away); but as a semantic model or a quick-and-dirty implementation, I think it might work. It's kind of like a classical generator (akin to Python's 'yield' statement), except without any effect on control flow. Now, back to talking about multisets. Another way to implement this behavior would be to define a data structure which could contain any number of items, and which, when accessed, would fork execution and yield all the items in it, one per thread. Of course, alternately the data structure could simply iterate over the items. The point is that the code receiving the data structure in question is written to receive a single item of the appropriate type -- there's no provision for looping or parallelism; it's all implied by the data. The reason I mentioned the classical array languages APL/J/K/NIAL is that their implicit iteration is very much what I want. By the way, Stevan, do you have an opinion on NIAL? > > Of course, I'm not sure if my idea is a solution _at all_, so I'm a > > little leery of getting too much into the details. Still not sure. Won't get any gut feeling until I code something in it. At least I'm now being more specific than I was. > i've been wondering whether, instead of having 'set' and 'multiset' > datatypes, you have two types of characteristic function. a set cf > is a function f s.t. f x -> 1 iff x is in the set represented by > f, and f x -> n iff x occurs in the multiset n times. then implement > set-algebra with h.o.f.'s 'union', 'diff', etc. manfred? The multiset paper I posted in my previous email here gave some very interesting points on this matter. -Billy