Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ---------------square----------------------------------
- (def sqr (comp (partial apply *) (partial repeat 2)))
- ; --------------pallindrome-----------------------------------
- (def trim-ends (comp butlast rest))
- (def not-nil (comp not nil?))
- (def first-last-equal? (comp (partial apply =) (partial (juxt first last))))
- (def is-pallindrome? (comp (partial every? first-last-equal?) (partial take-while not-nil) (partial iterate trim-ends)))
- ; ----------------prime---------------------------------
- (def divides? (comp (partial zero?) (partial rem)))
- (def is-prime? (comp (partial apply not-any?) (juxt (partial partial divides? ) (partial range 2))))
- ;--------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement