Я на Ubuntu 18.04, использую Racket 7.6. Я создал этот файл, hello.rkt:
#lang racket
(define (hello) 'hello-world)
(hello)
Затем я вызвал его:
> racket hello.rkt
'hello-world
Отлично. Затем я попытался загрузить код в REPL и использовать его:
> racket -i hello.rkt
Welcome to Racket v7.6.
> (hello) ; the function is unavailable here
; hello: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
> (load "hello.rkt") ; load gives no error, but ...
> (hello) ; the function is unavailable here
; hello: undefined; ...
> (require "hello.rkt") ; require gives no error ...
'hello-world ; and runs (hello), but ...
> (hello) ; the function is unavailable here
; hello: undefined; ...
> (include "hello.rkt") ; include gives no error, but ...
> (hello) ; the function is unavailable here
; hello: undefined; ...
> (enter! "hello.rkt") ; enter! gives no error, but ...
"hello.rkt"> (enter! "other.rkt") ; if I enter! another file ...
"other.rkt"> (hello) ; the hello function is unavailable here
; hello: undefined; ...
Вкратце: как загрузить файлы и использовать их содержимое в контексте REPL командной строки верхнего уровня?