Arc Forumnew | comments | leaders | submitlogin
1 point by globalrev 6056 days ago | link | parent

  (let acc 1
    		(for x 0 6 23456 666
			(= acc (/ acc 2))) acc)
why is the 23456 666 ignored? how can i just insert extra stuff there and nothing happens? where does it go, what can i do with it?

the problem with the func is the step, it need to subtract 1 and not step 1 at a time.



1 point by cchooper 6056 days ago | link

They aren't ignored, they just don't do anything. for can take any number of arguments: the first is the symbol, the second the start value, the third the end value, and the rest are all the body of the loop. They all get executed in every iteration. For example:

(for x 0 6 (prn 2345) (prn 666) (= acc (/ acc 2))) acc)

produces

  23456
  666
  23456
  666
  23456
  666
  23456
  666
  23456
  666
  23456
  666
  23456
  666
  1/128

-----