Re: [stack] Code Transformation Problem (possibly monadic?)
"Christopher Diggins" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Dec 11, 2007 10:30 AM, William Tanksley, Jr <[email protected]> wrote: > William Tanksley, Jr <[email protected]> wrote: > > However, I think I might be able to guess another possible semantics > > you might want. You want all 'm's contained in the source to somehow > > receive the one treatment, and all the other functions to receive > > another treatment. The problem is that Joy's quotations make things > > complex by nesting semantics. The obvious 'simple' solution is to > > start by flattening your function (using the transform we talked about > > earlier, while the group was discussing flatness); then replace each > > function or quoted function with its new semantics. I've still got to > > figure out what the correct semantics are for this transform; I > > haven't figured that out. > > I think I have an answer. > > Let T be your transform. T(m) = dup [m] dip; T([m]) = dup [m] cons; > T(x) = [x] dip; T([x]) = [x] swap. Finally, the top-of-stack must be > dropped at the end of the transformed sequence. I really appreciate your help here. I have not yet convinced myself that this generalizes to dynamically constructed quotations but it looks really really close. I will try to come up with a set of examples and tests. The insight of flattening is particularly helpful. - Christopher