Wow, this area is dead. I liked the first post, but to be honest, I'm very much in the beginners category for both Common Lisp and Scheme.

Seeing as the last thread was started a good 3/4 yr previous, thought it couldn't hurt to post another. Either everyone has left the LispForum-Quiz-of-the-delta-T and I'm talking to myself, or people out there are waiting for #2. I read a little up on the Ruby quiz -- comes originally from the Perl-quiz-of-the-week, which had this in its charter:

The 'regular' quiz can be solved using only techniques and functions found in Learning Perl (3rd edition) by Schwartz and Phoenix. The 'expert' quiz may be difficult. The two kinds of quizzes appear on alternate weeks.

Since the last one was a bit tough, this one should be easy. Plot the mandelbrot set. Define a function (mb rmin rmax imin imax) taking 4 real numbers, that will print-print-plot a 30 row, 50 column image of the mandelbrot set

And the no-spoiler period is up. (although we should try to get the next no-spoiler period to expire on Monday next time, as is customary).

Don't want to clutter up things much, but I can't resist throwing my chip in: http://codepad.org/rk6S6he9. Style feedback most welcome -- I'd like to know if my code is putting the proverbial foot in the mouth. ^_^

1. A lazy infinite list works well to generate the Mandelbrot numbers.2. Functional style doesn't make this much uglier than an imperative style.3. I like working with ranges of numbers as standalone, concrete sequences. It feels more decoupled than traditional loops, for some reason.

Some things Clojure does not so well:

1. No "built-in" support for complex numbers, so I have to import a bunch of contrib libraries for it.2. Clojure's package/lib import syntax never ceases to be ugly and verbose in my eyes.3. I couldn't figure out how to avoid an explicit loop/recur. I tried reduce but didn't have any success.

aaronla your code looks good to me, but my eyes were starting to cross at all those nested loops and lets.

Because of the support for complex numbers, this is pretty simply expressed in common lisp. I've made it a little more flexible with optional height/width arguments but otherwise left along. A clear improvement would be add a look up table into a list of characters ordered by "brightness"....

@unne - i wasn't able to run your code because it appears I don't have the contrib libraries. Is that something you have to download separately? I haven't really done much with clojure yet, other than install it and run thru the first tutorial page.

Heh, yeah, the 'do's and 'let's can be a bit dizzying at first. This is what happens initially when a C++ developer learns scheme -- 'do's replace 'for's, and 'let*'s replace sequences of assignments. Hopefully my scheme coding will improve with time.

@simon - wow, that is some serious LOOP-fu. I'd heard that CL's LOOP was its own embedded language, but i think this is perfect demonstration of that fact. Do you find LOOPs to be practical in general, or was this more a good opportunity to take LOOP to extreme?

aaronla wrote:@unne - i wasn't able to run your code because it appears I don't have the contrib libraries. Is that something you have to download separately? I haven't really done much with clojure yet, other than install it and run thru the first tutorial page.

aaronla wrote:@simon - wow, that is some serious LOOP-fu. I'd heard that CL's LOOP was its own embedded language, but i think this is perfect demonstration of that fact. Do you find LOOPs to be practical in general, or was this more a good opportunity to take LOOP to extreme?

Actually, that's only about 6 out of 10 on the LOOP-fu scale. I've seen far worse.

LOOP looks scary when you first approach it, but you'll quickly find that it's very useful. That said, I'm trending toward using ITERATE now.