Skip to content

Instantly share code, notes, and snippets.

@werenall
Created February 18, 2018 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save werenall/e546aac5a6c4dae10b731c8a990401d4 to your computer and use it in GitHub Desktop.
Save werenall/e546aac5a6c4dae10b731c8a990401d4 to your computer and use it in GitHub Desktop.
Calculate something in a checkup and eventually return that calculation
;; 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]
@werenall
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment