Re: "dict"ionary typing?

Kilian Evang <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 28-11-13 12:10, Jan Wielemaker wrote:
> 
> No. For two reasons. First of all, functional notation is intended to
> pass arguments to other predicates. Of course, you can use this with
> =/2, but that is certainly not intended to be the prime target. Second,
> overloading is/2 will hinder type reasoning and efficiency (is/2 is
> generally compiled into VM codes).
> 
>> I realize the functional notation could not be used directly in goal
>> arguments then. But so what? That's Prolog. IMHO a consistent syntax is
>> well worth the slight added verbosity.
> 
> Before dicts, I was mostly using library(option), library(record), or
> library(assoc) to do the job. I've got lots of code using these. I
> consider it far too verbose though, and I'm certainly not alone here.
> Just look at all the functional extensions for Prolog floating on the
> web. Getting the . available as an operator is the one and only
> opportunity to do something about this.

Okay, it does sound handy. But why stop at dicts? Can we also get a ./1
which also "evaluates expressions in place" without a dict to call it
"on"? The functional syntax so far provides "method calls", why not also
"function calls"? For example:

calc(Expr) := Result :-
  Result is Expr.

?- length(List, .calc(1 + 1)).
List = [_G1821, _G1824].

Kilian
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.