Re: playing around with dicts
"Richard A. O'Keefe" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 16/12/2013, at 9:41 PM, Jan Wielemaker wrote:
>
> Why it is is because how dicts are currently represented.
I wasn't asking "what is it about the current implementation
that makes this not work" but "what is it about the abstract
semantics that makes it inappropriate". LIFE psi-terms
_could_ be clause heads.
> At this moment, unifying two dicts succeeds only if they can be made the
> same. There are several other operations to do partial matching. We can
> still change things here.
In the "frames" design I did for Erlang, I initially made
frame construction expressions and frame patterns symmetric.
But that turned out to miss the whole point of having frame
patterns: typically you only _want_ to match a few fields.
We were discussing
> person{name:john} to match
> any person{.....} as long as ..... included a name:john maplet.
and that is *precisely* a case where the pattern and the argument
can be made the same. I've forgotten the LIFE syntax, so I'll
make it up, but
person(name=>john, height=>197) :-
...
would certainly match
?- person(age=>42, name=>john)
because both terms unify to yield
person(age=>42, height=>197, name=>john).