Playing with iterate
-
- Posts: 447
- Joined: Sat Jun 28, 2008 7:49 am
- Location: Austin, TX
- Contact:
Playing with iterate
I was fiddling around with the ITERATE package in SBCL this evening. What's the best way to resolve the various symbol conflicts between ITERATE:FOR and CL:FOR, ITERATE:COLLECT and CL:COLLECT, etc? It seems like these would always clash with the standard LOOP macro symbols. Ideally, I'd just (USE-PACKAGE :ITERATE) and be done with it.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
Re: Playing with iterate
There are no "LOOP macro symbols". Loop keywords are used by symbol name, not identity, so symbols from ITERATE package work perfectly well. You just have to do (USE-PACKAGE :ITERATE) before any code using LOOP is read, so that the reader won't intern them in the current package. Of course, using new package created with DEFPACKAGE would be best, but overkill for playing around I guess...
-
- Posts: 406
- Joined: Sat Mar 07, 2009 6:17 pm
- Location: Brazil
- Contact:
Re: Playing with iterate
One problem about interning iterate symbols I had was with metatilities. Metatilities' and iterate's package both export the symbol minimize (and another symbol I can't remember), so using both packages generates a conflict. Fortunatelly, I don't use those functions in metatilities, so I just shadow them. Even if I did use those symbols, I can always use minimizing instead of minimize in iterate.
Re: Playing with iterate
Like others have said, this should just work.findinglisp wrote:Ideally, I'd just (USE-PACKAGE :ITERATE) and be done with it.
Iterate is my primary looping construct. I love it. It's clear, lispy and I rarely have to check to manual to use it (very important!

-
- Posts: 447
- Joined: Sat Jun 28, 2008 7:49 am
- Location: Austin, TX
- Contact:
Re: Playing with iterate
I figured it out. Yes, it just works. I was playing around in the CL-USER package at the REPL when I was doing this and I had already read some stuff with LOOP before I loaded ITERATE. I was also loading it with "(require 'iterate)" which was obviously creating the ITERATE symbol in CL-USER as a part of reading that form, and then immediately conflicting with ITERATE:ITERATE when I said "(use-package 'iterate)". Duh.
Sorry for the trouble.

Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/