From: Markus Triska Date: Tue, 22 Dec 2020 20:59:11 +0000 (+0100) Subject: small documentation improvements related to the new indexing strategy X-Git-Tag: v0.9.0~164^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=1c76c869efadc641e5f71cb6d01df1eccc667bc0;p=scryer-prolog.git small documentation improvements related to the new indexing strategy --- diff --git a/README.md b/README.md index 6688f01f..2b41ca91 100644 --- a/README.md +++ b/README.md @@ -233,24 +233,23 @@ in all clauses of a predicate's definition. We call this strategy first *instantiated* argument indexing. A key motivation for first instantiated argument indexing is to enable -indexing for meta-predicates such as `maplist/N` and `foldl/N`, where -the first argument is a goal or partial goal that is a variable in the -definition of these predicates and therefore cannot be used for -indexing. +indexing for meta-predicates such as `maplist/N` and `foldl/N`, whose +first argument is a partial goal that is a variable in the definition +of these predicates and therefore cannot be used for indexing. For example, a natural definiton of `maplist/2` reads: ``` maplist(_, []). -maplist(Goal, [L|Ls]) :- - call(Goal, L), - maplist(Goal, Ls). +maplist(Goal_1, [L|Ls]) :- + call(Goal_1, L), + maplist(Goal_1, Ls). ``` In this case, first instantianted argument indexing automatically uses the *second* argument for indexing, and thus prevents choicepoints for calls with lists of fixed lengths (and deterministic goals). -Conveniently, no auxiliary predicates with reorderd arguments are +Conveniently, no auxiliary predicates with reordered arguments are needed to benefit from indexing in such cases. Conventional first argument indexing naturally arises as a