• 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
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
          • Lambda
          • Warrant
          • Defwarrant
          • Badge
          • Lambda$
          • Tame
          • Defbadge
          • Print-cl-cache
          • Introduction-to-apply$
          • Well-formed-lambda-objectp
          • Rewriting-calls-of-apply$-ev$-and-loop$-scions
          • Mixed-mode-functions
          • Explain-giant-lambda-object
          • Gratuitous-lambda-object-restrictions
          • Scion
            • Ilk
            • Ev$
            • Translam
            • Fn-equal
            • Apply$-guard
            • L<
            • Apply$-lambda-guard
            • Apply$-userfn
            • Badge-userfn
            • Defun$
            • Apply$-lambda
          • Loop$
          • Programming-with-state
          • Arrays
          • Characters
          • Time$
          • Defmacro
          • Loop$-primer
          • Fast-alists
          • Defconst
          • 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
          • 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
    • Apply$

    Scion

    A function ancestrally dependent on apply$

    The function fn is a scion of apply$ or simply a scion if the function is ancestrally dependent on apply$. That is, fn is apply$, or fn calls apply$, or calls a function that calls apply$, or calls a function that calls a function that calls apply$, etc.

    Meriam-Webster defines scion as ``a descendant of a wealthy, aristocratic, or influential family.''

    Examples of scions include apply$, collect$ and foldr, where the last two are defined as shown below.

    (defun$ collect$ (fn lst)
      (if (endp lst)
          nil
          (cons (apply$ fn (list (car lst)))
                (collect$ fn (cdr lst)))))
    
    (defun$ foldr (lst fn init)
      (if (endp lst)
          init
          (apply$ fn
                  (list (car lst)
                        (foldr (cdr lst) fn init)))))

    Note: Collect$, which is part of the support for the loop$ statement, is pre-defined in ACL2 but foldr is not.

    Most often, scions treat one or more of their arguments as ``functions,'' i.e., have at least one formal of ilk :FN. But that is not necessarily the case. Collect$-squares, as defined below,

    (defun$ collect$-squares (lst)
      (collect$ (lambda$ (x) (* x x)) lst))

    is a scion even though it does not have a formal of ilk :FN. However, it calls the scion collect$.

    The function defined by

    (defun$ collect$-expr (x lst alist)
      (if (endp lst)
          nil
          (cons (ev$ x (cons (cons 'v (car lst)) alist))
                (collect$-expr x (cdr lst) alist))))

    is a scion because it calls ev$ which calls apply$ in the mutually recursive clique that defines them both. Note that the ilks of the formals of collect$-expr are :EXPR, NIL and NIL, respectively. The function collects the successive values of the expression x under extensions of alist binding the variable symbol v to successive elements of lst.

    In the early days of apply$ we used the term ``mapping function'' to refer to scions. But that nomenclature was misleading because in the Lisp culture ``mapping'' tends to be understood as a kind of linear iteration.

    Fans of higher order logic have suggested we use the term ``functional'' for our scions, or at least for those scions having at least one formal of ilk :FN. However, we have resisted that suggestion because a functional takes a function as an argument and is thus a higher-order entity, but ACL2 is first-order, functions are never objects in ACL2, and the values of our :FN formals are ordinary objects like symbols and lists that are interpreted as functions.