Re: Functional syntax

Alan Baljeu <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
>>>> ?- length(List, .calc(1 + 1)).

>>  >> List = [_G1821, _G1824].


I wrote: 

>>> Or (1.1).calc() to match other syntax.

Sic.  I meant (1+1).calc().

or in general (Term).predicate(Args)
There are a few variations that might be implemented here.

Also possible is Term.Index.


From: Jan Wielemaker <[email protected]>
>>  >I provisionally like this.  As there are several issues to be
>>  >resolved wrt. function expansion in the first place, I'm not
>>  >in a hurry though.  Note that right now, you can get this to
>>  >work as expected (using is/calc/eval/...):
>>
>> Can you elaborate what sort of issues need be resolved?
>One is still on the radar: how to interact with DSLs that do not
>wish to use this as functional notation.  Also the interaction
>with meta-calls is quite delicate.


The LISP way is to do one of these:
with_functional_expansion(stuff), other_stuff


and any A.B found in stuff gets expanded.  Or


without_functional_expansion(stuff), other_stuff 
any A.B found in other_stuff gets expanded

Note that if expansion is compile-time, and can be 
disabled, it's easy for a programmer to structure 
code so the data elements are not subject to unwanted
rewrites.

As for meta-calls, I think these two points cover most issues:
1) any term rewrite produces a comma-list
2) ./2 is callable
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.