Jorge
Thanks very much (and all the other people! - Filip, Raph, Yves) for
bearing with me on this.
I am pretty clear now on all the issues (including the
non-declarativeness of the problem, my attempt to simulate the
functionality of a Prolog-like "cut" by using guards, and all that).
I suspect the devilish mind of the person that set it may have dwelt on
some of the banana-peel possibilities that this particular spec creates,
even in sequential, non-declarative languages.
I am glad at least that the problem held your interest!
======================================
I am left with the following impressions (dunno if they're correct):
1) Trying to map a sequential problem into a declarative style is a bit
of a minefield. In this case, I think that writing a special search
engine would have been the best approach to preserve my original
semantics, the problem is simple enough for that. However, it is
probably not the way to go for your average noob, pondering a computing
challenge that focussed on productivity!
Maybe some kind of primitive to enforce sequential execution in a
concurrent environment would also be of use here.
2) The penalty search method suggested would probably be quite a
realistic way to approach real-world problems of this type. It does not
surprise me that Raph's aquaintance uses it.
3) Yves' solution is probably closest to what I was looking for, but I
haven't gone over it fully yet!
4) I still don't understand why my use of the CurrIsNum variable worked
OK! After all, it belongs to the "current space", just like
"FoundWord", and there it is unbound. Different values can be bound to
it in the two choice branches, yet when it leaves the "choice", the
uncloned, "current space" has become bound (correctly). Filip says that
this is because "I'm not using it to simulate a 'cut'", but I'm afraid
you've lost me there...
If "CurrIsNum" was cloned inside the "choice" statement, how come the
binding made _inside_ the choice statement propagated back to the
"current space" correctly? Surely the "current space" should have
remained unbound?
========
Anyway, thanks again for all your valuable input, people...
AG
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users