Code
;; necessary_variables_in_let.clj
( def string "rgaraga4agjrj4rikllmrfmghjqwwrwengek" )
( defn sieve [ string ]
( let [ first-4-letters ( take 4 string )
unique-letters ( set first-4-letters )
length ( count unique-letters )]
( if ( = length 4 )
( clojure.string/join "" first-4-letters )
( if ( = length 0 )
( println "Nothing found" )
( recur ( rest string ))))))
( defn sieve-2 [ string ]
( let [ first-4-letters ( take 4 string )
length ( ->> first-4-letters
set
count )]
( if ( = length 4 )
( clojure.string/join "" first-4-letters )
( if ( = length 0 )
( println "Nothing found" )
( recur ( rest string ))))))
( defn number-of-unique-letters [ string ]
( ->> string
set
count ))
( defn sieve-3 [ string ]
( let [ first-4-letters ( take 4 string )
length ( number-of-unique-letters first-4-letters )]
( if ( = length 4 )
( clojure.string/join "" first-4-letters )
( if ( = length 0 )
( println "Nothing found" )
( recur ( rest string ))))))
( sieve-3 "abracadabra" )