Reputation: 1409
I am trying to declare a hash table. Based on this SRFI I believe that the form (define x (make-table))
ought to result in the correct behavior; however, I am getting the following error.
CHICKEN
(c) 2008-2017, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.12.0 (rev 6ea24b6)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2017-02-19 on yves.more-magic.net (Linux)
#;1> (make-table)
Error: unbound variable: make-table
Call history:
eval.scm:211: ##sys#get
eval.scm:218: values
eval.scm:255: ##sys#alias-global-hook
modules.scm:769: ##sys#qualified-symbol?
modules.scm:777: ##sys#active-eval-environment
modules.scm:777: g2354
modules.scm:784: mrename
modules.scm:762: ##sys#current-module
eval.scm:259: ##sys#symbol-has-toplevel-binding?
eval.scm:265: ##sys#symbol-has-toplevel-binding?
library.scm:1668: after
eval.scm:857: g1785
<eval> (make-table)
library.scm:4051: ##sys#get-call-chain
library.scm:3834: ##sys#make-vector
library.scm:1371: ##sys#allocate-vector <--
In addition, I am getting similar errors for other functions. Is it possible I have installed the interpreter incorrectly?
Upvotes: 1
Views: 316
Reputation: 2292
CHICKEN does not ship with SRFI 90, and as far as I can tell so far nobody has made an egg for it, either. An earlier and more commonly used hash table library, SRFI-69, is part of core, though. It is also not available by default, you'll need to use it like so:
(use srfi-69)
In CHICKEN 5 (which I highly recommend you install, as it has many many improvements and is the currently supported major version), SRFI-69 is no longer part of core but can be installed as an egg via chicken-install
. There, use
no longer exists. Instead, after installing the egg you can import it like so:
(import srfi-69)
As an aside, SRFIs are "requests for implementation", and not every Scheme system implements every single SRFI. Sometimes because people object to the SRFI (some are controversial), sometimes because nobody has gotten around to it, sometimes because the SRFI is unimplementable/does make sense for a particular Scheme (for example, a C FFI makes no sense in a Scheme running on the JVM).
You'd have to check your Scheme's features to see if the SRFI you'd like to use is included. Note that for CHICKEN, many SRFIs are implemented outside of the core via eggs. CHICKEN core includes only a handful of SRFIs, like 0, 1, 2, 4, 6, 8, 9, 11, 13, 14, 15, 16, 17, 23, 30, 39, 55, 69. In CHICKEN 5, the SRFIs 1, 13, 14 and 69 have been taken out of core as they can be implemented externally quite easily. Check the list of eggs for more SRFI implementations.
Edit: I forgot, there's a wiki page that strives to list all supported SRFIs exhaustively. It hasn't been updated for CHICKEN 5 yet, but the list should eventually be the same, as more and more eggs get ported from CHICKEN 4 to 5 (and even become longer, given that CHICKEN 5 sees much new development).
Upvotes: 3