From ok@atlas.otago.ac.nz  Fri Dec 15 02:13:57 2000
Received: from atlas.otago.ac.nz (atlas.otago.ac.nz [139.80.32.250])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id CAA00641;
	Fri, 15 Dec 2000 02:13:55 +0100 (MET)
Received: (from ok@localhost)
	by atlas.otago.ac.nz (8.9.3/8.9.3) id OAA28121;
	Fri, 15 Dec 2000 14:14:10 +1300 (NZDT)
Date: Fri, 15 Dec 2000 14:14:10 +1300 (NZDT)
From: "Richard A. O'Keefe" <ok@atlas.otago.ac.nz>
Message-Id: <200012150114.OAA28121@atlas.otago.ac.nz>
To: jan@swi.psy.uva.nl, nicos@soi.city.ac.uk
Subject: Re: [SWIPL] About Applying a predicate to all the elements of a list
Cc: prolog@swi.psy.uva.nl

Nicos Angelopoulos <nicos@soi.city.ac.uk> wrote:
    alternatively one might use syntactic transformations
    during compile time and factor out the meta call,
    (term_expansion/2) 

    the transformation is straight forward since 
    it doesnt depend on any other information,

    the drawback of course is that you get
    extra clauses in your database and that these
    clauses are dynamic (due to use of assert)

No reason why they should be dynamic,
provided term_expansion/2 is Quintus-compatible.

If you want to construct a new predicate to be called in some clause,
you just return a *list* of clauses.
    
A rather better approach, which would not require you to allow all
predicates in a file to be discontiguous, would be to have a
end_of_file_expansion(+FileName, -ClauseList) hook that is called when
compile, consult, &c reach the end of a file.  Then you can squirrel
away all the clauses you want, and pick them up after all the other
predicates in the file.
.d

