Re: [q-lang-users] Special values or failing functions
Brought to you by:
agraef
From: Alexander N. <AN...@sp...> - 2007-05-18 04:56:09
|
Hello Albert, Friday, May 18, 2007, 12:52:10 AM, you wrote: AG> Alexander Nickolsky wrote: >> len [] = 0; >> len [[H|Hs]|T] = _FAIL_; >> len [H|T] = 1+len T; >> >> so semantics of _FAIL_ would be : rewrite the current match with >> itself and return. >> So, 'fail' applies to the left side, but _FAIL_ applies to the right side. AG> I don't grok this last sentence. Should 'len [[1,2],3]' return 'len AG> [[1,2],3]' itself, or _FAIL_, or what? And what should 'len [1,[2,3]]' AG> return? I mean 'fail' acts as if the current rule's left side did not match. _FAIL_ is a regular function. I think 'len [[1,2],3]' should return 'len [[1,2],3]'. As it has been already mentioned, () is a great no-value designator. -- Best regards, Alexander mailto:AN...@sp... |