Re: Functional syntax

Carlo Capelli <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABty9wwQCYXbUOzMFhZGr=pK+LoUGTS7C7LwaUg9evga4XsfSA@mail.gmail.com>
I crafted my own tiny interface, I'll show it since I got a positive review
from an user...

 1 ?- [lifter].

% lifter compiled into lifter 0.01 sec, 13 clauses

true.


2 ?- length(List, ° is 1+1).

List = [_G1367, _G1370].


We can name lifted variables, if are worth reuse


3 ?- length(List, °L is 1+1), length(L2, ° is L+2).

List = [_G1740, _G1743],

L = 2,

L2 = [_G1746, _G1749, _G1752, _G1755].


4 ?- append(length(°, °L is 1+1), length(°, ° is L+2), Longer).

L = 2,

Longer = [_G1897, _G1900, _G1903, _G1906, _G1909, _G1912].

If someone is interested, it's on
github<https://github.com/CapelliC/prolog-snippets>.
I'm willing to correct it, if some bug will be found (of course :).

bye Carlo

2013/12/4 Kilian Evang <[email protected]>

> On 04-12-13 13:24, Jan Wielemaker wrote:
> > I provisionally like this.
>
> Glad to hear it!
>
> > Note that right now, you can get this to work as expected (using
> > is/calc/eval/...):
> >
> > length(List, math{}.is(1+1)).
>
> Yes, I also thought of that, but this is so verbose as to cancel out the
> benefit of writing it functionally rather than with an extra variable
> and extra goal. At least for my taste. A compact functional syntax along
> the lines of what I sketched, on the other hand, might really change the
> way I write Prolog. Some day.
>
> > My first goal is to get V7 stable wrt. the new features and exploit
> > these features in the libraries.  This includes finding solutions
> > for people getting into trouble with some of the new features.
>
> Absolutely, I see that stabilizing the current V7 has priority. Curious
> to see what you will decide once that is done. :)
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
-------------- next part --------------
HTML attachment scrubbed and removed
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.