Arc Forumnew | comments | leaders | submitlogin
1 point by tokipin 5944 days ago | link | parent

version using accum and aif

  (def observe (row col range)
      (accum append
        (for i (- range) range
        (for j (- range) range
            (aif (showpos (+ row j) (+ col i))
                 (append it))))))
i tried making a showpos using aand like so:

  (def showpos (row col)
      (aand (world row) (it col)))
but it errors on out-of-bounds <_< i was hoping the errsafe was for using nil as a function


1 point by bOR_ 5944 days ago | link

thanks for the (- somevariable)! I was using there (and in other places) still ( -1 somevariable)..

-.variable = (* -1 variable) work just fine in arc.

errsafe was a trick I learned from my previous 'improve this function' post :).

-----