Re: [stack] Fwd: [Factor-talk] cleave, 2cleave, and spread
"Daniel Ehrenberg" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Apr 3, 2008 at 10:12 PM, John Nowak <[email protected]> wrote: > > > While cleave/2cleave do seem to form a possible base, they are > impossible to type. That's not to say cleave isn't convenient, but for > convenience alone you can always offer it as a macro that translates a > statically-known list of functions to the same thing in terms of some > simpler core set. I'd argue that using cleave with arrays not known at > compile-time is very difficult for a human to reason about anyway and > likely should be avoided in all cases. > > - John If cleave/2cleave/spread are considered to take an array as an argument, they can't be typed. But if they take a heterogeneous vector, whose length and the types of all entries are known before runtime, then it should be possible to give it an overall type given some mechanism to do calculations on types. I just don't know what that type is, exactly... Given how complicated their type would be, though, I think a dup/swap/dip/drop base would be easier to work with in a statically typed language. Dan