Re: metaprogramming
Feliks Kluzniak <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Hi,
You mean "terms", not "predicates", right?
If we assume the list is properly formed and non-empty (for what should be the result of converting an empty list?), then the following should work:
convert( [ X ], X ).
convert( [ X | T ], (X , CT) ) :- T \= [], convert( T, CT ).
Hope this helps,
-- Feliks
On Aug 29, 2013, at 19:50, Josef Frydl <[email protected]> wrote:
> Hi, does somebody already know how to take the list of predicates and enclose all the member in parentheses and members are separated by comma.
>
> example
> [ a(A),b(B),c(C) ] --> (a(A),b(B),c(C) )
>
> Thanks Josef Frydl
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog