SWI-Prolog / issues

Dummy repository for issue tracking
7 stars 3 forks source link

Type error: `dict-key' expected, found `a/b' (a compound) #100

Closed erikkaplun closed 3 years ago

erikkaplun commented 3 years ago

The documentation on dicts has this example (5.4.1.2 Predefined functions on dicts):

?- write(t{a:t{b:x}}.get(a/b)).
x

however, on SWI Prolog 8.2.0, I get instead:

?- write(t{a:t{b:x}}.get(a/b)).
ERROR: Type error: `dict-key' expected, found `a/b' (a compound)
...
JanWielemaker commented 3 years ago

The docs document the current development version. Key-paths are a new addition. .get(a).get(b) should work fine, as well as simply .a.b which will raise an error rather than failing if a key is missing.