【问题标题】:r6rs and define-record-typer6rs 和定义记录类型
【发布时间】:2013-11-11 10:56:04
【问题描述】:

大家好,

对于课程,我必须导入一些库。

我遇到了一个错误,在检查了库之后,问题基本上归结为

r6rs 出现此错误:define-record-type: unbound identifier in module in:define-record-type

在这个图书馆:

#lang r6rs

(library
 (scenario-line)
 (export new say-what says-who say-it)
 (import ;...
  )

 (define-record-type scenario-line
   (new figure text)
   scenario-line?
   (figure says-who)
   (text say-what))

 (define (say-it scenario-line)
   (diagonal-paste (diagonal-paste (says-who scenario-line) 
                                   (new-cloud 15 15)) 
                   (new-text-cloud (say-what scenario-line)))))

【问题讨论】:

标签: scheme racket r6rs


【解决方案1】:

您遗漏了 import 声明,这是找出未绑定标识符的最重要部分!

标识符 define-record-type 是从 (rnrs records syntactic) 导出的,因此您需要确保其中一个导入是:

(import (rnrs records syntactic))

来自 R6RS 文档:

句法层由 (rnrs 记录句法 (6)) 图书馆。规范的一些细节以术语解释 下面的程序层的规范。

记录类型定义形式define-record-type是一个定义和 可以出现在任何其他人可以出现的任何地方。 ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-08
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 2022-08-19
    • 2011-09-15
    • 1970-01-01
    • 2011-11-03
    相关资源
    最近更新 更多