[cduce-users] default match policy not working in sequences

Matthias Radestock matthias at sorted.org
Wed Nov 3 23:38:53 CET 2004


Giuseppe Castagna wrote:

> We could write
> 
> (x:=1) for the non consuming pattern
> (x+=1) for the consuming one
> and define (x?=1) as a shorthand for (x+=1)|(x:=1)

I actually had the same idea. However, I believe Alan's /p syntax is 
only  meant to be valid inside a regexp - for a good reason: it is 
unclear what it means to "not consume anything" outside the context of 
regexp pattern, e.g. if := was a general notation for a non-consuming 
pattern, what would
  let (x:=1) = <expr>
or
  let (x:=1)/AType = <expr>
mean?

Btw, note that there would be no reason to define a syntax for a 
consuming default pattern (your += above), other than convenience, since 
(x+=c) is equivalent to _ & (x:=c).


Matthias.




More information about the Cduce-users mailing list