Arc Forumnew | comments | leaders | submitlogin
1 point by silence 5742 days ago | link | parent

I am learning arc too and came up with this:

  (def foo (l)
     (avg:map [if (isa _ 'int) _ (foo _)] l))
drcode's version is even better. I didn't know about errsafe either. Out of curiouslity, is there a performance impact to using errsafe in this way since there will be an error for each integer in the list?


2 points by drcode 5742 days ago | link

I don't know if I'd actually write something like that in a real program... not because of performance (which isn't good, but merely by a constant factor, so it's not an issue IMHO) but because the errsafe could hide other errors...

that said, the performance, in theory, might actually be better in some cases: lists (but not atoms) will be processed with one less condition.

-----