This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
r7rs libraries question
- From: Jeff Gonis <jeff dot gonis at gmail dot com>
- To: kawa at sourceware dot org
- Date: Sun, 9 Nov 2014 23:17:47 -0700
- Subject: r7rs libraries question
- Authentication-results: sourceware.org; auth=none
Hi Folks,
I was playing around with kawa 1.9 as I worked to figure out the
library syntax that arrived with r7rs. I have run into a bit of a
puzzle regarding libraries and built-in functions and I thought I
would contact the list to see if I was misunderstanding the standard,
misunderstanding how kawa interacts with the repl, or just plain
making a mistake.
If I have a file, we'll call it lib1.scm, and I want to play around
with my own "square" function (I know, I know, you'd never do this for
real) I might put together the following.
(define-library (lib1)
(import (except (scheme base) square))
(export square)
(begin
(define (square n)
(* n 2))))
I am under the impression that the above will bring in the base r7rs
library, except for the builtin square function which I will of course
be replacing with my clearly incorrect version.
Then in my main file, or perhaps at my emacs repl I have the following:
(include "lib1.scm")
(import (scheme base))
(import (prefix (lib1) lib1-))
(square 8)
(lib1-square 8)
Now I would expect that the first call to square would use the builtin
version that I imported from (scheme base) and return 64. I would
also expect that the next call to my prefixed version will use my
incorrect definition and return 16.
No dice however, they both return 16, which means that the prefix call
isn't doing what I think it should be doing with builtin functions.
It should be noted that if I create two libraries that define
identically named functions which aren't part of the base library,
then prefixing appears to work just fine, and the prefixed versions
dispatch correctly.
Anyway, I want to say that I am really having a great time with Kawa
and thank you so much for your hard work. Thanks as well, for any
help that you can offer me.
- Jeff