Advertisement
Guest User

Untitled

a guest
Jun 9th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn catching-test [selector]
  2.   (try
  3.     (text selector)
  4.     (catch NoSuchElementException e
  5.       nil)))
  6.  
  7. (defn when-let-test [selector]
  8.   (when-let [item (element selector)]
  9.     (text item)))
  10.  
  11. (defn nil-test [selector]
  12.   (text selector)) ;; won't work in the current codebase.
  13.  
  14. (defn testing [selector]
  15.   (let [catchex (catching-test selector)
  16.         whenex (when-let-test selector)
  17.         niltest (nil-test selector)]
  18.     (cond-> {}
  19.             catchex (assoc :catching-test catchex)
  20.             whenex (assoc :when-let-test whenex)
  21.             niltest (assoc :nil-test niltest))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement