• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defconst
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
        • Program-wrapper
        • Get-internal-time
        • Basics
          • Let
          • Return-last
          • Mv-let
          • Flet
          • Or
          • Mv
          • And
          • Booleanp
          • If
          • Not
          • Equal
          • Implies
          • Iff
          • Macrolet
          • Quote
          • Let*
          • Case-match
            • Pattern-match
              • Constructor-pattern-match-macros
              • Def-pattern-match-constructor
              • Pattern-match-list
                • Pattern-matches-list
                • Pattern-matches
                • Pml
                • Pm
            • ACL2-count
            • Case
            • Good-bye
            • Cond
            • Null
            • Progn$
            • Identity
            • Xor
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Pattern-match

    Pattern-match-list

    Pattern matching to a list of terms.

    Example:

    (pattern-match-list
      (a b c d)
      (((cons !c x) 3 (list* !b y) x)
       (declare (ignore x))
       (foo y))
      (& default-value)))

    pml is a convenient abbreviaton of pattern-match-list.

    Matches a list of terms to a list of pattern clauses. See pattern-match for more documentation of the pattern semantics. The first argument to pattern-match-list should be a list of input terms. (For best efficiency, these terms should be bound variables or simple constants, not containing function calls.) Each subsequent argument should be a pattern clause, consisting of a list of the following items:

    1. a list of patterns, the same length as the list of input terms
    2. a declare form, used when evaluating the test forms (optional)
    3. any number of test forms, which may use variables bound in the pattern (optional)
    4. a declare form whose scope is the body (optional)
    5. the body, an expression to be evaluated if the pattern matches and all the tests succeed.

    The final pattern clause may be of the form (& default-value); this is an exception to the convention that the pattern list must be a list same length as the input list, and it simply defines a default value for the pattern-match clause, to be returned instead of nil when all patterns fail.

    See also pattern-matches-list, which simply tests whether or not a certain pattern list matches the list of inputs.