• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
        • Term
          • Lambda
          • Pseudo-termp
            • Pseudo-term-fty
              • Pseudo-term-lambda
              • Pseudo-term-call
              • Pseudo-term-fncall
              • Pseudo-lambda
              • Pseudo-term-var
              • Pseudo-term-quote
              • Pseudo-term-kind
              • Pseudo-fnsym
              • Pseudo-term-null
              • Pseudo-term-case
                • Pseudo-term-count
                • Def-ev-pseudo-term-fty-support
                • Def-ev-pseudo-term-congruence
                • Pseudo-term-fix
                • Pseudo-var
                • Pseudo-term-list-fix
                • Pseudo-fn
              • Std/typed-lists/pseudo-term-listp
            • Term-order
            • Pseudo-term-listp
            • Guard-holders
            • Termp
            • Termify
            • L<
            • Kwote
            • Kwote-lst
          • Ld
          • Hints
          • Type-set
          • Ordinals
          • Clause
          • ACL2-customization
          • With-prover-step-limit
          • Set-prover-step-limit
          • With-prover-time-limit
          • Local-incompatibility
          • Set-case-split-limitations
          • Subversive-recursions
          • Specious-simplification
          • Defsum
          • Gcl
          • Oracle-timelimit
          • Thm
          • Defopener
          • Case-split-limitations
          • Set-gc-strategy
          • Default-defun-mode
          • Top-level
          • Reader
          • Ttags-seen
          • Adviser
          • Ttree
          • Abort-soft
          • Defsums
          • Gc$
          • With-timeout
          • Coi-debug::fail
          • Expander
          • Gc-strategy
          • Coi-debug::assert
          • Sin-cos
          • Def::doc
          • Syntax
          • Subversive-inductions
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Pseudo-term-fty

    Pseudo-term-case

    Case macro for pseudo-term objects.

    This macro can be used to conveniently branch on the kind of a pseudo-term and access its fields. It supports the five basic kinds of pseudo-term and their fields as well as the extra pseudo-kinds :call and :const as described in pseudo-term-fty. Among them, the following examples show all the cases and all the accessors that can be used in each case.

    (pseudo-term-case x
       :const (list 'quote x.val)
       :var (list 'quote (cdr (assoc x.name a)))
       :call (list x.fn (eval-list x.args a)))
    
    (pseudo-term-case x
       :null (list 'null)
       :quote (list 'quote x.val)
       :var (list 'var x.name)
       :lambda (list 'lambda x.fn x.formals x.body x.args)
       :fncall (list 'fncall x.fn x.args))
    
    (pseudo-term-case x
      :var nil
      :call (ground-term-listp x.args)
      :otherwise t)