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

时间:2021-10-24 22:04:01

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

2 个解决方案

#1


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...

#2


If you don't care about what "language" you use, you might just use R6RS. Here is how to get what you want in R6RS:

如果您不关心您使用的“语言”,则可以使用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)

#1


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...

#2


If you don't care about what "language" you use, you might just use R6RS. Here is how to get what you want in R6RS:

如果您不关心您使用的“语言”,则可以使用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)