球拍,包括,要求和提供不起作用 [英] Racket, include, require and provide don't work

查看:32
本文介绍了球拍,包括,要求和提供不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为functions.rkt"的文件,里面有一些函数.

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

我正在处理另一个文件,我们将其命名为working.rkt"

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

我在working.rkt"中尝试了以下(一一)以使用functions.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?

他们在同一条路上.

推荐答案

在functions.rkt"文件中:

In the file "functions.rkt:

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

在文件working.rkt"中:

In the file "working.rkt":

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

这篇关于球拍,包括,要求和提供不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆