Re: [q-lang-users] Special values or failing functions
Brought to you by:
agraef
From: John C. <co...@cc...> - 2007-05-17 14:08:09
|
Albert Graef scripsit: > As you point out, it would be nice to have a 'fail' which not only fails > the current equation, but *all* equations for the current redex. That's > an interesting idea, because it doesn't interfere as much with the > rewriting semantics as the catch/throw exception handling which Q > already offers as a means to exit a function anywhere. Shame on me that > I didn't think about this before! ;-) I'm tempted to actually implement > this as an experimental feature. What does everybody else think about > this? How should we name this operation? Presumably "const bottom;" somewhere in the standard library is enough? I like the name "bottom". > In this special case it would make sense to use 'inf' (defined in > math.q) as a sentinel value for non-existing links. IMHO it's better to use "nan" than "inf" in the numeric case. It has exactly the right semantics. -- Work hard, John Cowan play hard, co...@cc... die young, http://www.ccil.org/~cowan rot quickly. |