Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Iteration in DrScheme

Name: Anonymous 2009-03-29 7:19

Okay, so I'm writing some shit in DrScheme (http://www.plt-scheme.org/, basically it's a derivative of LISP) and I'm trying to figure out how the fuck I should go about implementing iteration. I wrote some quite decent code using for loops to avoid the complicated recursion hell that LISP tends to subject you to but now that I go to run it, it keeps throwing up this error:

reference to undefined identifier: for

Basically, wtf is this shit? PLT Scheme guide section 11 is pretty clear that things like
(for ([i '(1 2 3)])
      (display i))
are perfectly valid scheme. Am I missing something painfully obvious, or is something really fucked up going on?

Name: Anonymous 2009-03-29 8:05

>>4
To the best of my knowledge, scheme doesn't have a for loop. Usually, you implement iteration through recursion. If you had read even a small amount of the wizard book you would know that.

I think however you're looking for for-each i.e.

(for-each display (list 1 2 3))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List