tizoc/shen-scheme

Dict only works with symbol keys

NHALX opened this issue · 1 comments

NHALX commented

This is maybe not a bug, since the documentation for 'get' mentions symbols specifically. But since 'hash' has type (A --> number --> number), limiting keys to symbols seems unnecessary. The common lisp port is more flexible in this regard.

Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen 20.1
running under Scheme, implementation: chez-scheme
port 0.16 ported by Bruno Deferrari


(0-) (put test field 1)
1

(1-) (get test field)
1

(2-) (put "test a" field 1)
1

(3-) (get "test a" field)
Exception in get: value not found
tizoc commented

Thanks, this is indeed a bug, but not because of put and get.

As you noted, the first argument to put/get has to be a symbol, otherwise the behaviour is undefined:

Shen/Scheme uses Chez' native hash tables, but I tried to optimise too much:

Will fix in next release.