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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.