From 06cd483055b4b078a605f5badbb096835cb44dfe Mon Sep 17 00:00:00 2001 From: vsc Date: Tue, 18 Jun 2002 04:08:01 +0000 Subject: [PATCH] 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 --- docs/yap.tex | 13 +++++++------ library/apply_macros.yap | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/yap.tex b/docs/yap.tex index 8fba18679..f24116fb9 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -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. diff --git a/library/apply_macros.yap b/library/apply_macros.yap index 1c62b4a61..a38985779 100644 --- a/library/apply_macros.yap +++ b/library/apply_macros.yap @@ -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). -