Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.sprintlink.net!howland.reston.ans.net!Germany.EU.net!EU.net!sun4nl!freya.let.rug.nl!vannoord
From: vannoord@let.rug.nl (Gertjan van Noord)
Subject: Re: term_expansion
Sender: news@let.rug.nl (News system at let.rug.nl)
Message-ID: <1995Apr8.181102.3830@let.rug.nl>
Date: Sat, 8 Apr 1995 18:11:02 GMT
References: <3ltgng$gjn@erinews.ericsson.se>
Nntp-Posting-Host: grid.let.rug.nl
Organization: Faculteit der Letteren, Rijksuniversiteit Groningen, NL
Lines: 36

In article <3ltgng$gjn@erinews.ericsson.se> ehsjony@ehs.ericsson.se writes:
>
>I am implementing some syntax sugar for an OO add-on to prolog. I have some
>problem on how to expand the following:
>
>Input:
>
>f([a,b,c]).
>
>translates to:
>
>f(a).
>f(b).
>f(c).
>
>The way I do it today is asserting f(a),.. into the database but I would
>rather let term_expansion handle it for me. This is what I want, but it
>does not work:
>
>term_expansion(f([H|T]),B) :- 
>	?? how do I do the translation
>
>Thanks in advance,
>
>/jonas
>
>
>
In Sicstus Prolog the second argument of term_expansion can be a list of c
clauses:

term_expansion(f(List),Sols) :-
	findall(f(El),member(El,List),Sols).



