In Chicken it looks like I can (use srfi-9), but in Guile it looks like you say (use-modules (srfi srfi-9)), in Racket it is (require srfi/9). Is there a standardized use-module form that should work across all scheme implementations (so that I can write portable code)?

有帮助吗?

解决方案

Yes, in R6RS and R7RS, use:

(import (srfi …))

import is the 'standard form' for this. The trouble is that the can depend on the implementation. So the problem is moved down one level. I've seen:

(import (srfi :0))
(import (srfi srfi-0)

in different implementations.

其他提示

For R6RS and R7RS there is a method to load libraries so it really should be possible. I know that you can do (import (srfi :9)) and it works in Ikarus as well as Racket. I'm unsure as if there exists a standard to what the naming convention should be so it might be different in other implementations. You might need to make wrappers for certain implementations.

In R5RS you'll have to rip the reference implementation and use load. This won't use the implementations optimized code at all. I've seen projects that make implementation specific start file that makes use of what they support and add code for those who don't to get the best performance.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top