Re: [stack] sweetening concatenative syntax
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Mar 6, 2008, at 5:52 PM, John Nowak wrote:
> null? = [true] [cons false] unlist
Wrong!
null? :: {a} -> {a} bool
null? = [null true] [cons false] unlist
Better. Alternatively, if you *don't* want to keep the list around:
null? :: {a} -> bool
null? = [true] [pop pop false] unlist
The first version makes a lot more sense in a linear language. The
unconsing and consing can also be easily optimized out that way. Keep
in mind that you never really use 'null?' if you have 'unlist' anyway.
- John