Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Compare: Constraints & modes

Showing with 21 additions and 0 deletions.
  1. +21 −0 Constraints-&-modes.md
21 Constraints-&-modes.md
View
@@ -11,3 +11,24 @@ Currently we have a pretty useless experimental `defc` in the master branch. It
```
The body of the constraint would run when one of the modes have been satisfied. We could probably use the mode information to automatically generate the body of the `IRunnable` implementation.
+
+### Complications
+
+It turns out that implementing assoc isn't quite as simple as it sounds. When going in "reverse" there actually mutiple possibilities if the first argument to `assocc` is fresh. This leads me to think a better test of this functionality would be proper implementation of `conjo` which would be polymorphic on it's input and output argument.
+
+Imagine the following where `coll`, `v` are fresh. `o` is a bound to a map.
+
+```clj
+(run* [q]
+ (fresh [v o]
+ (== o {:foo 1})
+ (conjo q [:foo v] o)))
+```
+
+There are two possiblities, either `q` is a map that doesn't include the entry, or it included the entry and it has some yet unknown value. So we should see the following results:
+
+```clj
+({} {:foo _0})
+```
+
+We now have to deal with precisely the same issues that are present in CLP(Set).
Something went wrong with that request. Please try again.