daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ---------------square----------------------------------
  2.  
  3. (def sqr (comp (partial apply *) (partial repeat 2)))
  4. ; --------------pallindrome-----------------------------------
  5.  
  6. (def trim-ends (comp butlast rest))
  7. (def not-nil (comp not nil?))
  8. (def first-last-equal? (comp (partial apply =) (partial (juxt first last))))
  9. (def is-pallindrome? (comp (partial every? first-last-equal?) (partial take-while not-nil) (partial iterate trim-ends)))
  10. ; ----------------prime---------------------------------
  11.  
  12. (def divides? (comp (partial zero?) (partial rem)))
  13. (def is-prime? (comp (partial apply not-any?) (juxt (partial partial divides? ) (partial range 2))))
  14. ;--------------------------------------------------
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top