+;
+
+: apply ( vals proc )
+ dup case
+ primitive-proc-type of
+ drop execute
+ endof
+
+ compound-proc-type of
+ 2dup procedure-body ( argvals proc bproc )
+ -2rot 2dup procedure-params ( bproc argvals proc argnames )
+ -2rot procedure-env ( bproc argnames argvals procenv )
+
+ -2rot 2swap
+ flatten-proc-args
+ 2swap 2rot
+
+ extend-env ( bproc env )
+
+ ['] evaluate-eproc goto
+ endof
+
+ continuation-type of
+ \ TODO: Apply continuation
+ endof
+
+ except-message: ." object '" drop print ." ' not applicable." recoverable-exception throw
+ endcase
+;
+
+: application-executor ( operator-proc arg-procs env -- res )
+ 2rot 2over ( aprocs env fproc env )
+ evaluate-eproc ( aprocs env proc )
+
+ -2rot 2swap ( proc env aprocs )
+ evaluate-operand-eprocs ( proc vals )
+
+ 2swap ( vals proc )
+
+ ['] apply goto
+;
+
+: analyze-application ( exp -- eproc )
+ 2dup operator analyze
+ 2swap operands operand-eproc-list
+
+ ['] application-executor primitive-proc-type
+ nil cons cons cons
+;
+
+:noname ( exp --- eproc )
+
+ self-evaluating? if analyze-self-evaluating exit then
+
+ quote? if analyze-quoted exit then
+
+ variable? if analyze-variable exit then
+
+ definition? if analyze-definition exit then
+
+ assignment? if analyze-assignment exit then
+
+ macro-definition? if analyze-macro-definition exit then
+
+ if? if analyze-if exit then
+
+ lambda? if analyze-lambda exit then
+
+ application? if analyze-application exit then
+
+ except-message: ." tried to analyze unknown expression type." recoverable-exception throw