Type of Define expression in Scheme

与世无争的帅哥 提交于 2019-11-30 20:49:43

In Racket define is a special form and not an expression, so it doesn't have a value per-se, if you try to execute something like this you'll get an error:

(display (define x 42))
=>  define: not allowed in an expression context in: (define x 42)

If it were to have a value it'd be something akin to void, but that will be dependent on the particular implementation details of the interpreter (I believe I saw one interpreter return #t after a define was completed)

The constant #<void> is returned by most forms and procedures that have a side-effect and no useful result

The specification doesn't go into details on this point, either - reinforcing the statement that it's implementation-dependent.

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