如何在方案中导入模块?

问题描述 投票:2回答:1

我很新的计划。我试图在方案中导入模块“排序”。我尝试了从(加载排序)到(打开排序),(导入排序)的所有内容。我能够使用

,open sorting 

当我在计划bash。但是我想将模块导入到方案文件中。我正在使用scheme48

scheme scheme48
1个回答
3
投票

您需要使用模块语言。

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

基本上,不是只写一个普通的方案文件,而是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

© www.soinside.com 2019 - 2024. All rights reserved.