Torsten Anders wrote:
Dear all,

I just came across a behaviour of Oz' pattern matching I don't quite understand. The following simple expression returns [a#1 b#1 c#1 d#1 e#1]:
{Map [a b c d e] proc {$ A ?X} X=A#1 end}

I did expect the second expression to behave exactly as the first. Hover, this expression blocks instead:

{Map [a b c d e] proc {$ A X#1} A=X end}

I don't understand why -- am I missing something obvious here? Not that this poses any problems as such -- it only took me quite some time to find out why my program blocks...
I think the easiest is to translate the statement into the core syntax:

declare Out in
local UnnestApply1 Proc1 in
  proc {Proc1 A Formal1}
     case Formal1 of '#'(X 1) then
         X = A
     end
  end
  UnnestApply1 = '|'(a '|'(b '|'(c '|'(d '|'(e nil)))))
  {Map UnnestApply1 Proc1 Out}
end

Formal1 is never bound to '#'(X 1).

Cheers,
Luis

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to