On my Windows XP box with sbcl-1.4.14
I've installed the ASDF
using
(load "C:\\Program Files\\clisp-2.49\\asdf\\asdf.lisp")
(require :asdf)
(push "C:\\Documents and Settings\\mayhem\\lisp\\iterate\\" asdf:*central-registry*)
On SLIME
(require :iterate)
(iterate (for i from 1 to 5) (collect (* i i)))
gives The variable I is unbound error
If I do (in-package :iterate)
, the code above works fine but this time familiar functions such as exit
and other functions which I've defined in .sbclrc
cease to work, they give The function ITERATE::EXIT is undefined
type of errors, for example.
If I do (use-package :iterate)
, then it gives [Condition of type NAME-CONFLICT]
error.
So I began to use the package like this:
(iterate:iterate (iterate:for i from 1 to 5) (iterate:collect (* i i)))
But I think you'll agree that it's a bad style.
How to use the iterate
correctly?
Note: I've seen the post about the very similar problem but it didn't help. There aren't many posts or articles about this particular problem.
You need to say (use-package :iterate)
before you try to refer to unqualified symbols from the iterate
package.
What has happened in your case is this.
iterate
system into the running Lisp, creating a package called "ITERATE"
."CL-USER"
package you've typed (iterate ...)
, and the reader has worked out that it needs to find or create a symbol whose name is "ITERATE"
and which is accessible in the "CL-USER"
package.CL-USER::ITERATE
.ITERATE:ITERATE
so you get an error from the evaluator as it's trying to evaluate the arguments to a function (which doesn't exist, but it doesn't know that yet). In fact the error you're getting is while it's evaluating the first argument in the (for i ...)
subform.(use-package :iterate)
to tell the system to add the "ITERATE"
package to "CL-USER"
's search list.iterate
refer to the existing CL-USER::ITERATE
or the newly-accessible ITERATE::ITERATE
? (And there are some other conflicts too, probably)."CL-USER"
symbols', but you didn't take that option, I suppose.And the answer is: use the packages you want to refer to unqualified symbols from before you try to refer to those symbols unqualified.
(Also: Windows XP? I'm impressed by your retroness.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With