问题
I'm sure this is am extremely basic question, but I have two files and I want to import one function from that file into the other one. Is there a way to do so?
回答1:
You can use provide within a module to export definitions to other modules that import it with require:
;; a.rkt
(provide f)
(define (f x)
(displayln (add1 x)))
;; b.rkt
(require "a.rkt")
(f 3) ; => 4
For more information, see the docs.
来源:https://stackoverflow.com/questions/34756477/how-can-i-import-a-function-from-a-file-in-racket