You are looking at historical revision 2841 of this page. It may differ significantly from its current revision.

Compiler or interpreter?

How to determine if a program is running in the interpreter or as compiled code?

Alex Shinn suggested:


Based on that, John Cowan came with:

(cond-expand (compiling (define (compiled?) #t)) (else (define (compiled?) #f)))

Felix Winkelmann mentioned the test-feature? procedure which can do the proposed job too:

(test-feature? 'script)      ; running via csi -s
(test-feature? 'compiling)   ; running as a compiler extension (-X)
(test-feature? 'csi)         ; running in csi