To add to Chris's answer; the current input port is what is known as a โparameterโ, which is approximately approximately a parameter / variable with a dynamic scope. In general, it is cleaner and more conservative to set the current input port only temporarily using the parameterize parameter. Like this:
(parameterize ([current-input-port my-port]) ... do some stuff ... )
Evaluation of this code will cause the input port to be set for your body code and any code that it calls, but will not "flow" into code that is evaluated externally; it also cancels the change on an exclusive or continued exit.
source share