Scheme中`define`的返回值是多少? [英] What's the return value of `define` in Scheme?
本文介绍了Scheme中`define`的返回值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对Scheme中define
的返回值感到好奇.所以我在球拍中写了以下几行
I'm curious about the return value of define
in Scheme. So I wrote the following lines in Racket
#lang r5rs
(display (define a 3))
得到错误
define: not allowed in an expression context in: (define a 3)
我对此有2个问题:
- 这是否意味着
define
没有返回值? - 根据R5RS,
define
不是表达式.这是一个程序结构.仅表达式具有返回值,其他形式没有返回值是真的吗?
- Does it mean that
define
has no return value? - According to R5RS,
define
is not an expression. It's a program structure. Is it true that only expressions have return values, and other forms don't?
推荐答案
在可以有意义地获得返回值的任何上下文中使用define
都是无效的.因此,是否具有返回值是没有意义的.您将永远无法观察到它.
It's not valid to use define
in any context where a return value could meaningfully be obtained. So it's moot whether it has a return value or not; you'll never be able to observe it.
这篇关于Scheme中`define`的返回值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文