Playing with iterate

Discussion of Common Lisp

Playing with iterate

Postby findinglisp » Fri Mar 20, 2009 11:17 pm

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/
findinglisp
 
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Re: Playing with iterate

Postby Ramarren » Sat Mar 21, 2009 4:35 am

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...
Ramarren
 
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Re: Playing with iterate

Postby gugamilare » Sat Mar 21, 2009 5:22 am

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.
gugamilare
 
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil

Re: Playing with iterate

Postby aerique » Mon Mar 23, 2009 2:26 am

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! :))
aerique
 
Posts: 10
Joined: Sat Jun 28, 2008 9:06 am

Re: Playing with iterate

Postby findinglisp » Tue Mar 24, 2009 9:16 am

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.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
findinglisp
 
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX


Return to Common Lisp

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron