gpt4 book ai didi

module - 运行其他模块的子模块

转载 作者:行者123 更新时间:2023-12-01 00:01:29 25 4
gpt4 key购买 nike

我想有选择地从另一个模块运行 Racket 模块的子模块。请帮我填空!

文件 1

#lang racket/base

;; <big file, lots of code>

(module+ small-tests
;; basic correctness checks
(displayln "Small tests pass!")
)

(module+ big-tests
;; heavy duty stress tests
(displayln "Big tests pass!")
)

文件 2

#lang racket/base

(module+ main
;; Trigger either the small-tests or the big-tests,
;; depending on what's written here.
(require '???)
)

如果运行大型测试也能自动运行小型测试,那就太好了。

最佳答案

submod表单用于要求模块的子模块。

举个例子:

#lang racket

(module A racket
(module+ main
(displayln "Hello World")))

(module B racket
(require (submod ".." A main)))

(require 'B)

关于module - 运行其他模块的子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32685207/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com