This file contains hidden or 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
;;http://www.4clojure.com/problem/144 | |
;;Write an oscillating iterate: a function that takes an initial value and | |
;;a variable number of functions. It should return a lazy sequence of the | |
;;functions applied to the value in order, restarting from the first function after it hits the end. | |
(fn [n & funcs] (reductions #(%2 %1) n (cycle funcs))) | |
;;http://www.4clojure.com/problem/110 | |
;;Write a function that returns a lazy sequence of "pronunciations" of a sequence of numbers. | |
;;A pronunciation of each element in the sequence consists of the number of repeating identical |
This file contains hidden or 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
(require '[clojure.string :as str]) | |
(def test-tweets [ | |
"Saturday night is all right for sonnets." | |
"530 years ago today, Richard III tried to trade his kingdom for a horse. Turned out stock in his kingdom had dropped below mule.'" | |
"I never stay in London during August. Tis plague season." | |
"Nay, Falstaff doth not overeat. That is not where the calories come from." | |
"If you ask Polonius a question, you deserve the answer you get." | |
"Tragedy, for me, is when the best actress in a generation has his voice change." | |
"Fancy costumes, not much plot, cheesy moral tacked on at the end: superhero movies are just court masques." |