Russ Abbott wrote:
It may be that it's not needed, but for my own amusement, would you
show me how to implement univ in Oz. One use for it might be to write
a predicate that determines if a term is ground. Notice that
*local *X *in
* {Browse {IsDet p(X)}}
*end*
yields true. How would one write a predicate /IsGround/ that would
return true or false depending on whether it's argument contained any
unbound variables?
-- Russ
Here's a simple implementation of univ:
proc {Univ T L}
{WaitOr T L}
if {IsDet T} then
L={Label T}|{Record.toList T}
else
T={List.toTuple L.1 L.2}
end
end
For example:
{Univ T [f 3 2 e]} binds T=f(3 2 e)
{Univ f(3 2 s) L} binds L=[f 3 2 s]
Note that this implementation will only work for tuples (which are like
Prolog terms).
If you want it to work for full records, I leave it up to you!
This implementation should work in a concurrent setting because of
the WaitOr: it will wait until it knows in which direction it should go.
So it is actually more general than the Prolog version. But I haven't
tested it extensively, so caveat emptor!
Peter
PS: I read your draft article on 'Emergence Explained'. It's a very
readable introduction, thanks! After reading this article, I am left
wondering why there is a controversy between functionalism and
reductionism. There are clearly autonomous laws "above" physics,
and just as clearly, everything can be explained (albeit maybe in
a more complicated way) in terms of physics. Why there are
autonomous laws? This seems to be a property of certain kinds
of systems that permit design. Even very simple systems permit
this (like Turing machines), so it is no surprise that the universe
permits it also. Anyway, the article was insightful for me.
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users