OK, done
Best
Torsten
On May 4, 2008, at 5:08 PM, Raphael Collet wrote:
Dear Torsten,
That would be really nice to add such a comment. I even suggest to
use
a mixture of both, which shows all possible cases:
or S1
[] S2
[] S3 then S3
end
expands to something like
local
proc {C1} S1 end
proc {C2} S2 end
fun {C3} S3 proc {$} S4 end end
in
{Combinator.'or' C1#C2#C3}
end
Thanks a lot,
raph
Torsten Anders wrote:
Dear Raphael,
thanks for your reply. Is it OK if I add the following to the doc of
Combinator.'or'?
Best
Torsten
-- doc proposal
{Combinator.'or' +T}
implements disjunction. T is a tuple of either nullary or unary
procedures. The special syntax statement
or S1 [] S2 [] S3 end
expands to
{Combinator.'or' proc {$} S1 end # proc {$} S2 end # proc {$} S3
end}
whereas
or S1 then S2
[] S3 then S4
end
expands to the following
local
fun {C1} S1 proc {$} S2 end end
fun {C3} S3 proc {$} S4 end end
in
{Combinator.'or' C1#C2}
end
--
On May 4, 2008, at 3:22 PM, Raphael Collet wrote:
Dear Torsten,
I agree with you, these combinators definitely lack
documentation. But
here is how I found a solution to your problem: I simply looked
at the
'Core Syntax' of you guarded or-statement:
or X=1 then Y=11
[] X=2 then Y=12
[] X=3 then Y=13
end
The statement is equivalent to
local
fun {C1} X=1 proc {$} Y=11 end end
fun {C2} X=2 proc {$} Y=12 end end
fun {C3} X=3 proc {$} Y=14 end end
in
{Combinator.'or' C1#C2#C3}
end
Now we can infer the rule: a guarded clause "A then B" is
encapsulated
in a function that executes A and returns a procedure that
encapsulates
B. In other words: fun {$} A (proc {$} B end) end.
I also checked the implementation of the combinator (its source
code is
in the file share/lib/cp/Combinator.oz), and the rule above is
correct.
Cheers,
raph
____________________________________________________________________
_____________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
Office: +44-1752-586227
Private: +44-1752-558917
http://strasheela.sourceforge.net
http://www.torsten-anders.de
_____________________________________________________________________
____________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
______________________________________________________________________
___________
mozart-users mailing list mozart-
[EMAIL PROTECTED]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
--
Torsten Anders
Interdisciplinary Centre for Computer Music Research
University of Plymouth
Office: +44-1752-586227
Private: +44-1752-558917
http://strasheela.sourceforge.net
http://www.torsten-anders.de
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users