Is it possible to define a lookup relation for map keys, similar to (geto k m v)
? I saw that maps unify only over values, so this might be hard.
Okay,
(defn geto [m k v]
(featurec m {k v}))
Seems to do the trick, at least when k really is a keyword. I don't understand why it's limited to values thoughit is very tricky
if k is a key in m, and v is a value in m, and q unifies with m, what values does q have?
(values in the sense of, what are the possible values of q)
Hmm, I'd assume all values that (featurec m {k v})
produces? 😉
it is trivial to determine the values when keys are ground
What do you mean by ground?
a concrete value
a known keyword
Ok
(as opposed to a logic variable with an unknown value)
Yeah, got it
basically you can't use just a clojure map to represent that
you need some more complicated datastructure that understands unification and can do things like merge keys that are unified
like if you say (get m k v) (get m y x) (== y k)
uh, geto
Hm, so it would be possible, but only if I converted my maps to that richer datastructure before?
And I'd have to make it extend the unification protocol?
I am not sure
I feel like I was reading a paper on unifying maps recently
Really? Nice coincidence then 🙂
oh, no, it was clp(set)
Ah, ok
but I think that would be really similar
e.g. you would represent the map as a set of k/v pairs
there is a scheme implementation somewhere that needs porting
Hm yeah, it looks like this would do it, if it were implemented, which it doesn't seem to be 😄
(the link to the paper is in the readme on that repo)
Hm, that looks more like a weekend-y kind of thing 😉
I wouldn't mind a simpler way to achieve my goal, which is basically have an interpreter for a very simple language
I think the scheme guys just use a list of pairs
Yeah, that might be the way to go for now
Thanks, I'll try that
Also read the paper when I have a moment, which might be a while 😉