You're asking how to make a Scheme program run portably on R7RS and non-R7RS systems.
This is tricky in general. R7RS section 5.1 clearly states that a program must start with one or
more import declaration. There is a cond-expand form in library declarations, and a cond-expand
syntax exported by (scheme base), but that must be imported first.
Chibi actually does (non-portably) allow a top-level cond-expand, but you need to import `define`
first and separately before using it due to interactions between define and the expander:
(cond-expand
(chibi
(import (scheme base) (scheme write)))
Note this is for running programs. You could also just pipe the program into the repl
with `chibi-scheme < cond-expand-define.scm` and it would work because the repl
has a default environment.
--
Alex