Here's what I want as an option to case--especially since choice can't be used until after one knows about Computation Spaces. I want to be able to use and teach about unification as an independent topic. It's such a powerful construct that one should be able to use it on its own. Also, it should be usable as a Boolean,
i.e., does expr1 unify with expr2, which should be available as part of a control structure. So here's what I suggest.
Define a proc Unify/3 that attempts to unify its first two arguments and sets its third argument to true/false depending on whether not it succeeds.
local
proc {Unify X Y Z}
try X = Y Z = true
catch _ then Z = false
end
end
A B
in
if {Unify [A b a] [a B B]} then {Browse 1#A#B}
elseif {Unify [A b] [a B]} then {Browse 2#A#B}
end
end
It would be even nicer if value.'=' were defined as both =/2 and =/3, with the latter being defined as above.
-- Russ
_________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
