Arc Forumnew | comments | leaders | submitlogin
2 points by aw 5482 days ago | link | parent

Maybe a function like 'only', but which defaults to 0 instead of nil?

  (def default0 (f)
    (fn args (if (car args) (apply f args) 0)))

  arc> (default0.int "123")
  123
  arc> (default0.int nil)
  0


1 point by rocketnia 5481 days ago | link

You could even name it "0nly", with a zero. ^_^ That could be a bit deceptive, though.

-----