Re: metaprogramming

Michael Hendricks <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFHuXubTRN=sbVrdd0HZ2XmwiTKJsnbRfoPJmq-n=YjPzz6KfA@mail.gmail.com>
On Thu, Aug 29, 2013 at 11:50 AM, Josef Frydl <[email protected]> wrote:

> [ a(A),b(B),c(C) ]  -->  (a(A),b(B),c(C) )
>

?- pack_install(list_util).

?- [library(list_util)].

?- xfy_list(',', T, [a(A),b(B),c(C)]).
T = (a(A), b(B), c(C)).

xfy_list/3 works in other directions too:

?- xfy_list(',', (a(A),b(B),c(C)), L).
L = [a(A), b(B), c(C)].

?- xfy_list(Op, (a(A),b(B),c(C)), [a(A),b(B),c(C)]).
Op = (',').

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