Am Sonntag, den 12.10.2008, 22:55 +0200 schrieb felix winkelmann: > On Fri, Oct 10, 2008 at 10:18 PM, Jörg F. Wittenberger > <[EMAIL PROTECTED]> wrote: > > I just noticed that my srfi-35 files does not do enough. > > > > At the end there is a: > > > > (import (rename srfi-35 > > (condition? srfi35:condtition?) > > (message-condition? srfi35:message-condition?) > > (condition-message srfi35:condition-message))) > > (set! condition? srfi35:condtition?) > > (define message-condition? srfi35:message-condition?) > > (define condition-message srfi35:condition-message) > > > > No, it's not. message-condition? and condition-message I just added a > > second ago. > > Sorry, can't parse that.
My fault, indeed. So, I have this srfi-35 module and want to access it's bindings from top level and eval. I figured that a somewhat typing-extensive way would be to import the module into top level, renaming it's bindings and define top level variables bound to the renamed imports. The code snippet shows the example I used to try whether this works or not. This one did. > > > > Since there are a few more things to export according to the visible > > pattern, I guess that's what (import (prefix ... is supposed to be used > > for. But when I tried, I ended up with unbound things again. I would rather have used (import (prefix srfi-35 srfi35:)) . But either I did not understand what I should put where I left the ellipsis here or this might not work correctly at top level? Whatever I tried, the top level bindings ended up as undefined values (or was it unbound?). > > > > Please: could I get an example here. > > > > No problem, just tell me what you want to do. At best I would like to do: (define foo '(import (prefix srfi-35 srfi:35))) (define bar '(import (rename srfi-18 (raise issue)))) (define (export-them! lst envt) (fold-import-statements (lambda (param init) (apply environment-extend! init param) init) envt lst)) (define env (make-environment)) (export-them! foo env) (export-them! bar env) Now in "env" "issue" is bound to "raise", SRFI-35 is bound with prefix. Desperately: get an example how to save some typing with rename. Alternatively: get an idea how to save even more typing using low level access. /Jörg _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
