include new apply_macros code from Erick Alphonse

Acknowledge J. Schimpf


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@542 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-06-18 04:08:01 +00:00
parent 944d2e8aed
commit 06cd483055
2 changed files with 13 additions and 7 deletions

View File

@ -6486,13 +6486,14 @@ Library, Extensions, Builtins, Top
@section Apply Macros
@cindex macros
This library provides a set of utilities to apply a predicate to all
elements of a list or to all sub-terms of a term. They allow one to
This library provides a set of utilities for applying a predicate to
all elements of a list or to all sub-terms of a term. They allow to
easily perform the most common do-loop constructs in Prolog. To avoid
performance degradation due to @code{apply/2}, each call creates an
equivalent Prolog program, without meta-calls, which is executed by the
Prolog engine instead. Note that if the equivalent Prolog program
already exists, it will be simply used.
performance degradation due to apply/2, each call creates an
equivalent Prolog program, without meta-calls, which is executed by
the Prolog engine instead. Note that if the equivalent Prolog program
already exists, it will be simply used. The library is based on code
by Joachim Schimpf.
The following routines are available once included with the
@code{use_module(library(apply_macros))} command.

View File

@ -1,3 +1,9 @@
% File : apply_macros.yap
% Author : E. Alphonse from code by Joachim Schimpf
% Updated: 15 June 2002
% Purpose: Macros to apply a predicate to all elements
% of a list or to all sub-terms of a term.
:- module(apply_macros, []).
:- multifile user:goal_expansion/3.
@ -258,4 +264,3 @@ aux_args([Arg|Args], MVars, [Arg|PArgs], PVars, [Arg|ProtoArgs]) :-
pred_name(Macro, Proto, Name) :-
format_to_chars("'~a(~w)'.",[Macro, Proto], Chars),
read_from_chars(Chars, Name).