(defmacro try-or
"Evaluates exprs one at a time, from left to right. If a form returns a
value, this value is returned. If a form throws an exception, the next
form is evaluated.
If the last form throws an exception, the exception isn't caught."
([] nil)
([form] form)
([form & forms]
`(try
~form
(catch Exception e#
(try-or ~@forms)))))
try-cond
ReplyDeleteNo, never mind. try-or
ReplyDeletewhy not 'try-one ?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIt most closely matches the existing function some. So maybe try-some?
ReplyDeletegrayswx: some is a function (plus it takes a predicate), or is a macro. I think try-or is better.
ReplyDeletetry-harder!
ReplyDelete