[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] SRFI-42 and Importing in Chicken 4
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] SRFI-42 and Importing in Chicken 4 |
Date: |
Mon, 15 Dec 2008 23:24:50 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Mon, Dec 15, 2008 at 04:03:01PM -0600, Jack Trades wrote:
> I just got Chicken 4 compiled and am having some problems with importing.
>
> #;1> (import srfi-1)
> ; loading /usr/local/lib/chicken/4/srfi-1.import.so ...
> #;2> (take '(1 2 3) 2)
> Error: unbound variable: take
>
> The docs say "Importing a module does not load or link it - this is a
> separate operation from importing its bindings." How do I load it?
> (require-extension srfi-1) works but I would like to prefix the names from
> srfi-1.
You can just load the library with the form (require-library srfi-1)
After doing so you can use import on the module defined by the library.
> BTW would this be correct, (import srfi-1 (prefix srfi-1
> "list-funcs."))?
Not quite. (import (prefix srfi-1 list-funcs.)) would do the trick.
Then you can use (list-funcs.take '(1 2 3) 2)
> I also get this when trying to import or install srfi-42. Does
> chicken-setup work with Chicken 4?
It does. You'll need to load the library first here as well.
> Also, I'm trying to build a DSL for an evolutionary programming system, is
> there a way to prefix all Scheme symbols and modules? I would like
> something similar to s.car, s.list, s.+, etc. Can that be done in the
> REPL? It seems to import at least basic scheme by default.
When you define a new module, you _have_ to import the SCHEME and
CHICKEN modules explicitly. While doing so, you can use the prefix
trick I described a few paragraphs back.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
pgpNRHbusNs6c.pgp
Description: PGP signature