Calculate something in a checkup and eventually return that calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Instead of doing | |
(if (and (some? "checking if displaying it should even be considered") | |
(some->> txt (vector :div)) | |
(some->> txt (vector :div))) | |
;; => [:div txt] | |
;; Consider doing | |
(and (some? "checking if displaying it should even bbe considered") | |
(some->> txt (vector :div)) | |
;; => [:div txt] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Although this is smart, and smaller LOC-wise, I'm worried about code readability. It may not be obvious at the first glance that
and
returns either the first falsey it encountered or the the return value of the last clause.That said, should this snippet be used?