Last active
February 21, 2019 03:56
-
-
Save kaskichandrakant/6b4afe36e4fbc25731ee4aac74dcfcda to your computer and use it in GitHub Desktop.
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
; ---------------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)))) | |
;-------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment