简体   繁体   English

如何加载库以支持R5RS语言(哈希表)中的哈希表?

[英]How do I load library to support hashtable in R5RS language (DrScheme)?

Looks like R5RS language in DrScheme does not come with hashtable library.. 看起来DrScheme中的R5RS语言没有哈希表库。

when I run (make-hash-table) it throws an error... 当我运行(make-hash-table)时会引发错误...

Pretty Big has support for hashtable but does not support mutable pairs.. Pretty Big支持哈希表,但不支持可变对。

so I am stuck making one of them work for me .. 所以我坚持让他们中的一个为我工作..

How do I add support for hashtable in R5RS? 如何在R5RS中添加对哈希表的支持?

thanks 谢谢

I wasn't sure of how to do this either, but found how to import a module in r5rs: 我也不确定如何执行此操作,但发现如何在r5rs中导入模块:

(#%require scheme)

then... 然后...

(define h (make-hash))

etc... 等等...

If you don't care about what "language" you use, you might just use R6RS. 如果您不关心使用什么“语言”,则可以只使用R6RS。 Here is how to get what you want in R6RS: 这是在R6RS中获得所需内容的方法:

#!r6rs

(import (rnrs)
        (rnrs mutable-pairs))


(define foo (make-eqv-hashtable))

(define bar (list 'a 'b))

(write bar) (newline)

(set-car! bar 'Z)

(write bar)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM