substitutedfoldq
substitutedfoldq is a function commonly found in functional programming languages, particularly those influenced by Lisp or Scheme. It serves as a generalized fold, also known as a reduce or accumulate, operation that allows for a specific condition to determine whether an element is included in the accumulation process.
At its core, substitutedfoldq iterates through a collection (like a list or vector) from left to right,
The function typically takes three arguments: a predicate function, an accumulating function, and an initial value