Re: "dict"ionary typing?
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 12/05/2013 11:01 AM, Michael Hendricks wrote:
> ?- writeln(append([a,b],[c,d],~)).
> [a,b,c,d].
>
> ?- length(List, ~ is 1 + 1).
> List = [_G1821, _G1824].
This is indeed an interesting thought for using arbitrary
predicates as a function. The is/2 case looks nice. The
append case is a bit less convincing with the ~ burried
somewhere deep down in a term. Of course, typically at
least one of append's `input' arguments will be a variable.
I doubt it will work out satisfactoty for dicts. Compare
?- writeln(get_dict(x,D,~)).
to ?- writeln(D.x).
In the dict case, composition will also be quite typical
to access a field in a nested dict structure.
Also user functions on dicts play a different role as they
exploit the tag of the dict, making it as an object.
Cheers --- Jan