chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is part of the wiki's hello world example broken?


From: ipcore
Subject: Re: is part of the wiki's hello world example broken?
Date: Tue, 7 Apr 2020 10:16:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

Your import.so should be named "hello.import.so". Doing `(import NAME)` will pull in NAME.import.so automatically. (You don't need to `,l hello.so`, btw)

In your example, when you run `(import test)`, the interpreter does not find a local test.so, and so goes looking for it in $CHICKEN_REPOSITORY_PATH. There, it finds and loads the "test" egg, as you can see from this line:


> ; loading /usr/local/chicken-5.2.0/lib/chicken/11/test.import.so ...


The documentation could probably be a bit more explicit on this.


On 4/7/20 12:16 AM, Daniel Ortmann wrote:
On this page:
http://wiki.call-cc.org/man/5/Modules

Following these instructions:

    If you want to keep macro-definitions in a separate file, use import
    libraries:

    % csc -s hello.scm -j test % csc -s test.import.scm

I get 'unbound variable' for both hello and greet.
My own user error?  Or does something (perhaps doc) need updating?

dortmann@dortmann-linux2:ssax$ cat hello.scm
;; hello.scm

(module test (hello greet)
   (import scheme)

   (define-syntax greet
     (syntax-rules ()
       ((_ whom)
        (begin
          (display "Hello, ")
          (display whom)
          (display " !\n") ) ) ) )

   (define (hello)
     (greet "world") )  )
dortmann@dortmann-linux2:ssax$ rlwrap csi
CHICKEN
(c) 2008-2020, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.2.0 (rev 317468e4)
linux-unix-gnu-x86-64 [ 64bit dload ptables ]

Type ,? for help.
#;1> ,l hello.so
; loading hello.so ...
#;1> (import test)
; loading /usr/local/chicken-5.2.0/lib/chicken/11/test.import.so ...
; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.condition.import.so ... ; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.irregex.import.so ... ; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.port.import.so ... ; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.pretty-print.import.so ... ; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.process-context.import.so ... ; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.string.import.so ... ; loading /usr/local/chicken-5.2.0/lib/chicken/11/chicken.time.import.so ...
#;2> (hello)

_*Error: unbound variable: hello*_

         Call history:

         <syntax>          (hello)
_*        <eval>    (hello)       <--*_
#;2> (greet "you")

_*Error: unbound variable: greet*_

         Call history:

         <syntax>          (greet "you")
_*        <eval>    (greet "you") <--*_
#;2>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]