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
;; ummels's solution to Palindromic Numbers | |
;; https://4clojure.com/problem/150 | |
(fn [n] | |
(letfn [(decode [n] (if (< n 10) [n] (conj (decode (quot n 10)) (rem n 10)))) | |
(encode [x] (reduce #(+ (* % 10) %2) 0 x)) | |
(next-pal [n] | |
(let [N (decode n) | |
l (count N) | |
d (quot l 2) |
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
;; ummels's solution to Squares Squared | |
;; https://4clojure.com/problem/138 | |
(fn [start end] | |
(letfn | |
[(squares [start end] | |
(take-while #(<= % end) (iterate #(* % %) start))) | |
(arrange [x] | |
(let [n (count x) | |
dim (int (Math/ceil (Math/sqrt n))) |
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
;; ummels's solution to Love Triangle | |
;; https://4clojure.com/problem/127 | |
(fn [mine] | |
(let [n (count mine) | |
ln #(loop [r 1 v %] (if (< v 2) r (recur (inc r) (quot v 2)))) | |
m (apply max (map ln mine)) | |
lmax (fn [xs] ; treats nil as -infinity | |
(let [a (first xs) r1 (rest xs) b (first r1) r2 (rest r1)] | |
(cond (empty? r1) a |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |