Re: "dict"ionary typing?

Alan Baljeu <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
>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.


We want a functional notation.  '.' is surely not the only 
way to do this, but it may be a good way.  Limiting the notation 
to only dict objects would be a pity.

There's a hundred ways to make functional notation in Prolog.
The usual pattern of predicates is to have the last parameter 
as output.  The main thing in my mind that makes it Prologgy is
to have the behaviour governed by a predicate.

Therefore to give a lousy proposal, you could simply define:
:- op(fx, 122, compute), op(xfy, 230, @).
?- compute X = f1 @ f2(N,M) @ f3 @ f4(Y).

or ?- apply f4(Y),f3, f2(N,M), f1, =X.
or ?- reduce Y .f4 .f3 .f2(N,M) .f1 to X.

Or switch to any notation you like.  Note in the last case,
Y doesn't have to be a dict.  There is no need for
term_expansion to make it work, but term_expansion
can be done for efficiency, and it will be transparent.

Why?  Because Prolog code is data is powerful.
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.