[eeps] EEP XXX: Pattern-test operator

Richard O'Keefe ok@REDACTED
Mon Apr 30 03:23:13 CEST 2012


On 28/04/2012, at 7:12 AM, David Mercer wrote:

> On Apr 23, 2012, at 19:06, "Richard O'Keefe" <ok@REDACTED> wrote:
> 
>> 
>> On 24/04/2012, at 10:52 AM, Robert Virding wrote:
>> 
>>> I have missed one part of the discussion here and that is about ?=:
>>> why use ?= in a guard and not =, and what does ?= mean outside a
>>> guard?
> . . .
>>   The problem now is that EITHER
>>   f(X) when X = [] -> ...
>>> f([])
>>   fails (because the match X = [] succeeds but has value [] which is
>>   taken as false in a guard) OR the behaviour of = in a guard is
>>   inconsistent with its behaviour in an expression.
> 
> Why not
>> f(X = []) -> …
> 
> or
>> f(X) when X =:= [] -> …

The question is not "how do we match an empty list" for which
f([]) -> ... is as good as it gets, but
>>> why use ?= in a guard and not =, and what does ?= mean outside a
>>> guard?




More information about the eeps mailing list