Re: "dict"ionary typing?

"Richard A. O'Keefe" <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 29/11/2013, at 8:51 AM, Alan Baljeu wrote:

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

Lee Naish had a functional preprocessor.

I had one called 'funnel', which relied on declarations.
If a name/arity pair was declared as a function or if
there was a :- func [mod:]name/arity declaration, then
in a clause body
	p(...,name(T1,...,Tn),...)
=>
	name(T1, ..., Tn, T0),
	p(..., T0, ...)

Of course, if anyone wants to add functional syntax
in Prolog, they _really_ need to look at Mercury,
which does not introduce special syntax for function
calls but relies on declarations.

In fact, if you do this, it's wise to have two kinds
of declarations:

	:- type <type head>
	   ---> <cons1>(<types>)
	      ;
	      ; <consn>(<types>).

declares the constructor functions as *data* functions;

	:- func <func>(<types>) -> <type>.

declares the function as an *executable* function.

If you find a name/arity pair that is not declared as
one or the other, warn, and take it as data.

On the other hand, if you _really_ want functional
syntax, there are plenty of excellent functional languages
out there that have real conceptual unity and can take
advantage of that.

I found that functional syntax in Prolog was nowhere near
as useful as I expected it to be; I'm not even sure which
machine I left funnel on.

Because Mercury has strong static types and modes, the
situation is different there.
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.