Re: goal_expansion

Michael Hendricks <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFHuXubMXMvYgi+G04yy+QOiuNprUhhx4D23mefTRcE=VvGWAA@mail.gmail.com>
On Sat, Feb 8, 2014 at 5:46 PM, Jonathon Doran <[email protected]> wrote:

> I would very much like to see a simple example of the use of
> goal_expansion.
>

Here's a simple example:

$ cat goal-expansion.pl
goal_expansion(hi, writeln("Hello, world!")).

foo :-
    hi,
    hi.

$ swipl -s goal-expansion.pl
?- listing(foo/0).
foo :-
writeln("Hello, world!"),
writeln("Hello, world!").


> I have a large program, and I would like to make a series of changes.  I
> see that I am following the same pattern each time, and if I were writing
> in another language I would consider creating a macro.


> This may be the wrong technique to use in Prolog, but I'm curious if it
> would be possible.
>

I'm not entirely sure I understand the question.  Are you looking for an
automated way to edit your Prolog source files using something like
goal_expansion?  If so, I'm not aware of any tools like that yet.  I've
experimented with something along those lines but don't have anything
usable.

If I've misunderstood your question, let me know and I'll try again.

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