[LOGIC-49] minimal map type for unifying only part of a map Created: 31/Aug/12 Updated: 12/Oct/12 Resolved: 12/Oct/12 |
|
| Status: | Resolved |
| Project: | core.logic |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | David Nolen |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
currently it's a bit obnoxious that map unification must be over the entire map. It would be useful to have a new datatype - partial-map |
| Comments |
| Comment by Kevin Lynagh [ 12/Oct/12 12:44 PM ] |
|
How do you feel about letting partial map have a value meaning "don't unify with a map that has a key here". E.g., {:a ?x :b ?y} == {:a 1 :b 2 :c 3} => {:a 1 :b 2} but {:a ?x :b !_} == {:a 1 :b 2 :c 3} => nil My use case is doing map matching + rewrites and in some cases I don't want a partial-map to match a map that already has some keys defined. |
| Comment by David Nolen [ 12/Oct/12 1:10 PM ] |
|
Sure, but this is a separate ticket. Also it should be expressible via a normal goal - not-has-keyo or some such. Once that's done we can think about sugar. |
| Comment by Kevin Lynagh [ 12/Oct/12 1:16 PM ] |
|
Also on the Github: https://github.com/lynaghk/core.logic/tree/partial-map |
| Comment by Kevin Lynagh [ 12/Oct/12 1:31 PM ] |
|
Patch without !_ sugar. |
| Comment by Kevin Lynagh [ 12/Oct/12 1:47 PM ] |
|
Add patch, not diff. |
| Comment by David Nolen [ 12/Oct/12 1:52 PM ] |
|
fixed, http://github.com/clojure/core.logic/commit/9b340ea4fff2f4dad50b0f9631054e713b895fe8 |