Dear Daniel,
case, cond and or are explained in the tutorial:
http://www.mozart-oz.org/documentation/tutorial/node5.html#label33
http://www.mozart-oz.org/documentation/tutorial/node12.html#label68
case matches an expression to one or more patterns (there are no
guards).
or implements logical disjunction without backtracking -- only a single
guard must be entailed (or blocks until only a single guard is not
failed).
cond with multiple clauses is a commited-choice operator: the guards
run concurrently and the guard which is entailed first 'wins' (all
clauses which could also be entailed but are 'too late' are ignored).
This can be used, for example, for programming concurrent logic
programs which do not perform a search (i.e. never 'take back' a
decision once it is made).
Best,
Torsten
On 14.11.2006, at 15:29, Daniel Zingaro wrote:
Greetings,
I'm trying to decide whether to use 'or', 'case' or 'cond' to pattern
match over a term language and having trouble fully understanding the
differences. (I could just use 'case', but that would be no fun! ...)
'Case' seems to mimic the 'case' that we'd see in functional
languages: successively evaluate guards until one of them succeeds,
then evaluate the associated statement. If more than one guard would
succeed, use the first one.
But what is the difference between this, and 'or' and 'cond'? These
two seem to concurrently execute the guards and then execute the
statement associated with the one that succeeds (so I can't rely on
textual order of guards anymore). What happens, though, if multiple
branches of the 'or' or 'cond' succeed? We'd have two choices for the
statement to execute... ?
Thanks for any insights,
Dan
_______________________________________________________________________
__________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
--
Torsten Anders
Sonic Arts Research Centre • Queen's University Belfast
Frankstr. 49 • D-50996 Köln
Tel: +49-221-3980750
http://www.torsten-anders.de
http://strasheela.sourceforge.net
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users