• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
      • Gl
        • Term-level-reasoning
        • Glmc
        • Other-resources
        • Optimization
        • Reference
          • Def-gl-thm
            • Def-gl-rule
              • Find-and-remove-key
              • Defthm-using-gl
              • Gl-thm
            • Shape-specs
            • Symbolic-objects
            • Gl-aside
            • Def-gl-param-thm
            • Symbolic-arithmetic
            • Bfr
            • Def-gl-boolean-constraint
            • Gl-mbe
            • Bvec
            • Flex-bindings
            • Auto-bindings
            • Gl-interp
            • Gl-set-uninterpreted
            • Def-gl-clause-processor
            • Def-glcp-ctrex-rewrite
            • ACL2::always-equal
            • Gl-hint
            • Def-gl-rewrite
            • Def-gl-branch-merge
            • Gl-force-check
            • Gl-concretize
            • Gl-assert
            • Gl-param-thm
            • Gl-simplify-satlink-mode
            • Gl-satlink-mode
            • Gl-bdd-mode
            • Gl-aig-bddify-mode
            • Gl-fraig-satlink-mode
          • Debugging
          • Basic-tutorial
        • Witness-cp
        • Ccg
        • Install-not-normalized
        • Rewrite$
        • Fgl
        • Removable-runes
        • Efficiency
        • Rewrite-bounds
        • Bash
        • Def-dag-measure
        • Bdd
        • Remove-hyps
        • Contextual-rewriting
        • Simp
        • Rewrite$-hyps
        • Bash-term-to-dnf
        • Use-trivial-ancestors-check
        • Minimal-runes
        • Clause-processor-tools
        • Fn-is-body
        • Without-subsumption
        • Rewrite-equiv-hint
        • Def-bounds
        • Rewrite$-context
        • Try-gl-concls
        • Hint-utils
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Def-gl-rule

    Find-and-remove-key

    Remove keyword key and associated value from list lst

    Signature
    (find-and-remove-key key lst) → (mv * *)

    Definitions and Theorems

    Function: find-and-remove-key

    (defun find-and-remove-key (key lst)
     (declare (xargs :guard t))
     (let ((__function__ 'find-and-remove-key))
      (declare (ignorable __function__))
      (cond
       ((atom lst) (mv nil lst))
       ((and (equal (car lst) key)
             (atom (cdr lst)))
        (mv
         (er
          hard? __function__
          "Car of lst matches key, when there is no associated value in
                      the lst.  Car is: ~x0.  Lst is: ~x1"
          (car lst)
          lst)
         nil))
       ((equal (car lst) key)
        (mv (cadr lst) (cddr lst)))
       (t (mv-let (val recur-lst)
                  (find-and-remove-key key (cdr lst))
            (mv val (cons (car lst) recur-lst)))))))