Search                        Top                                  Index
HELP FORALL_MATCH                                   Rudi Lutz April 1983
                                Updated to use "!" Aaron Sloman Oct 1996

The format of this is:

    FORALL_MATCH ! <pattern> IN <list> DO
        <actions>
    ENDFORALL_MATCH

Its effect is to do <actions> for every possible way the <pattern> can match
<list>. <pattern> can be any pattern recognised by the normal pop matcher,
including ? and ?? variables, restriction procedures, = and == , etc. However
any restriction procedures will be applied in a strictly LEFT TO RIGHT order
(as they appear in the pattern).
In addition quitloop etc. should work if used in the <actions> .

Example of use:

lvars x y;

forall_match ! [== ?x == ?y ==] in [ 1 2 3 4] do
    x+y=>
endforall_match; ;;;finds all sums of pairs of numbers in a list

** 3
** 4
** 5
** 5
** 6
** 7

lvars x y z w u v;

forall_match ! [??x ??y [??z ??w] ??u ??v] in [a b [c d] e f] do
quitif(x=[a]);
    [x ^x y ^y z ^z w ^w u ^u v ^v]==>
endforall_match;

** [x [] y [a b] z [] w [c d] u [] v [e f]]
** [x [] y [a b] z [] w [c d] u [e] v [f]]
** [x [] y [a b] z [] w [c d] u [e f] v []]
** [x [] y [a b] z [c] w [d] u [] v [e f]]
** [x [] y [a b] z [c] w [d] u [e] v [f]]
** [x [] y [a b] z [c] w [d] u [e f] v []]
** [x [] y [a b] z [c d] w [] u [] v [e f]]
** [x [] y [a b] z [c d] w [] u [e] v [f]]
** [x [] y [a b] z [c d] w [] u [e f] v []]

Try that again without the quitif command.


--- File: local/help/forall_match
--- Distribution: all
--- University of Sussex Poplog LOCAL File ------------------------------

--- $poplocal/local/help/forall_match
--- Copyright University of Birmingham 1996. All rights reserved. ------