Arc Forumnew | comments | leaders | submitlogin
1 point by bogomipz 6169 days ago | link | parent

I'll just throw in that you can simplify the nested ifs slightly like this;

  (if (is step 0) (list start)
      ((if (> step 0) > <) start end) '()
      (cons start (range (+ start step) end step)))
Also, you might want to make the function tail recursive, but that's a criticism of the original rather than your addition.


1 point by bgutierrez 6169 days ago | link

Isn't this exactly the same as what I did, except with different formatting and a '() in place of a nil?...

-----

1 point by ryantmulligan 6169 days ago | link

the second line has less ifs

-----