How do you return from a function early in Clojure?

后端 未结 8 1279
不知归路
不知归路 2020-12-08 13:48

Common Lisp has return-from; is there any sort of return in Clojure for when you want to return early from a function?

8条回答
  •  半阙折子戏
    2020-12-08 14:06

    The if option already given is probably the best choice, and note since maps are easy, you can always return {:error "blah"} in the error condition, and{result: x} in the valid condition.

提交回复
热议问题