Racket, include, require and provide don't work

微笑、不失礼 提交于 2019-12-24 07:39:45

问题


I have a file with the name “functions.rkt”, where I have some functions.

And I am working in another file, let’s name it “working.rkt”

I have tried the following (one by one) at “working.rkt” to use the function defined at “functions.rkt”:

(require “functions.rkt”)

(include “functions.rkt”)

(provide “functions.rkt”)

And anyone of them hasn’t worked, any help?

They are in the same path.


回答1:


In the file "functions.rkt:

#lang racket
(provide my-function)
(define (my-function x) (* 2 x))

In the file "working.rkt":

#lang racket
(require "functions.rkt")
(my-function 21)


来源:https://stackoverflow.com/questions/43470743/racket-include-require-and-provide-dont-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!