Page 1 of 1

Playing with iterate

Posted: Fri Mar 20, 2009 11:17 pm
by findinglisp
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.

Re: Playing with iterate

Posted: Sat Mar 21, 2009 4:35 am
by ramarren
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...

Re: Playing with iterate

Posted: Sat Mar 21, 2009 5:22 am
by gugamilare
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

Posted: Mon Mar 23, 2009 2:26 am
by aerique
findinglisp wrote:Ideally, I'd just (USE-PACKAGE :ITERATE) and be done with it.
Like others have said, this should just work.

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! :))

Re: Playing with iterate

Posted: Tue Mar 24, 2009 9:16 am
by findinglisp
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. :roll: Sorry for the trouble.