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:
parent
944d2e8aed
commit
06cd483055
13
docs/yap.tex
13
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.
|
||||
|
@ -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).
|
||||
|
||||
|
Reference in New Issue
Block a user