[1] Any function defined in the underlying JavaScript can be used as a primitive for the metacircular evaluator. The name of a primitive installed in the evaluator need not be the same as the name of its implementation in the underlying JavaScript; the names are the same here because the metacircular evaluator implements JavaScript itself. Thus, for example, we could put list("first", head) or list("square", x => x * x) in the list of primitive_functions.
[2] JavaScript's apply method expects the function arguments in a vector. (Vectors are called arrays in JavaScript.) Thus, the arglist is transformed into a vector—here using a while loop (see exercise 4.7): function apply_in_underlying_javascript(prim, arglist) { const arg_vector = []; // empty vector let i = 0; while (!is_null(arglist)) { arg_vector[i] = head(arglist); // store value at index $\texttt{i}$ i = i + 1; arglist = tail(arglist); } return prim.apply(prim, arg_vector); // $\texttt{apply}$ is accessed via $\texttt{prim}$ } We also made use of apply_in_underlying_javascript to declare the function apply_generic in section 2.4.3.
4.1.4   Running the Evaluator as a Program