如何在Scheme中导入模块?

3

我是Scheme的新手。我正在尝试在Scheme中导入模块"sorting"。我尝试了从(load sorting)到(open sorting),(import sorting)的所有方法。我成功使用了

最初的回答。

,open sorting 

当我在scheme bash中时,我想将模块导入到一个scheme文件中。我正在使用scheme48。

翻译结果:

当我在Scheme Bash中时,我希望将模块导入到Scheme文件中。我正在使用Scheme48。

1个回答

3

你需要使用模块语言。

更多细节可以在这里找到:http://community.schemewiki.org/?scheme48-module-system

基本上,不要只编写一个普通的Scheme文件foo.scm:

;; foo.scm
(define (hello) (display "Hello World!"))

您需要使用模块语言

;; foo2.scm

;; this is not scheme, it's the module language
(define-structure hello (export hello)
  (open scheme)
  ;; or others here
  (begin
    ;; this is Scheme
    (define (hello) (display "Hello World!"))))

你可以在这里了解有关模块语言的更多信息:http://s48.org/1.8/manual/manual-Z-H-5.html

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接