• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Mutual-recursion
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Loop$-primer
        • Fast-alists
        • Defmacro
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Irrelevant-formals
        • Efficiency
        • 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
          • Or
          • Flet
          • Mv
            • Mv-let
            • Mv-nth
            • Mv-list
              • Mv?-let
              • Mv?
            • And
            • Booleanp
            • If
            • Not
            • Equal
            • Implies
            • Iff
            • Quote
            • Macrolet
            • Let*
            • Case-match
            • ACL2-count
            • Good-bye
            • Case
            • Cond
            • Null
            • Progn$
            • Identity
            • Xor
          • Packages
          • Defmacro-untouchable
          • Primitive
          • <<
          • Revert-world
          • Set-duplicate-keys-action
          • Unmemoize
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Defopen
          • Sleep
        • Start-here
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Mv
    • ACL2-built-ins

    Mv-list

    Converting multiple-value result to a single-value list

    Example Forms:
    ; Returns the list (3 4):
    (mv-list 2 (mv 3 4))
    
    ; Returns a list containing the three values returned by var-fn-count:
    (mv-list 3 (var-fn-count '(cons (binary-+ x y) z) nil))
    
    General form:
    (mv-list n term)

    Logically, (mv-list n term) is just term; that is, in the logic mv-list simply returns its second argument. However, the evaluation of a call of mv-list on explicit values always results in a single value, which is a (nil-terminated) list. For evaluation, the term n above (the first argument to an mv-list call) must ``essentially'' (see below) be an integer not less than 2, where that integer is the number of values returned by the evaluation of term (the second argument to that mv-list call).

    We say ``essentially'' above because it suffices that the translation of n to a term (see trans) be of the form (quote k), where k is an integer greater than 1. So for example, if term above returns three values, then n can be the expression 3, or (quote 3), or even (mac 3) if mac is a macro defined by (defmacro mac (x) x). But n cannot be (+ 1 2), because even though that expression evaluates to 3, nevertheless it translates to (binary-+ '1 '2), not to (quote 3).

    Mv-list is the ACL2 analogue of the Common Lisp construct multiple-value-list.

    Function: mv-list

    (defun mv-list (input-arity x)
           (declare (xargs :guard t)
                    (ignore input-arity))
           x)