[Haskell-cafe] Concept for "equal but unknown"
wren romano
wren at community.haskell.org
Sun Oct 4 23:39:49 UTC 2015
In the context of logic, the usual way to capture these sorts of
things is to introduce some notion of an event/eventuality which you
can use to index everything by. Then you can say that there exists
some index (e.g., hotel reservation) with such and such properties
(e.g., consumes a free room, provides the same room to the reservation
holder, etc). The connection between this semantic model and how you
write your program is, of course, up to you. Both the
pointer-indirection approach and the unification-variable approach can
be seen as ways of implementing this semantics.
As for a general concept, you may want to look into "constraint
satisfaction"/"constraint programming" (e.g., ECLPS Prolog
<http://eclipseclp.org>). The big idea here is that you can give each
variable a domain of possible values (which need not be the same for
all variables), and then you introduce a set of constraints on what
those values can be. This allows for capturing things like "I have
three reservations X, Y, and Z for three rooms A, B, and C such that
no room is booked twice and no reservation takes more than one room".
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list