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
ruby %~dp0kill_ruby_processes.rb |
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
source "https://rubygems.org" | |
gem 'rake' |
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
([:a, :b, :c].zip([1,2,3])).inject({}){|res, ele| res[ele.first] = ele.last; res} #=> {:c=>3, :a=>1, :b=>2} |
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
;http://4clojure.com/problem/22 | |
#(loop [coll % cnt 0] | |
(if (empty? coll) | |
cnt | |
(recur (next coll) (inc cnt)))) |
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
;http://4clojure.com/problem/23 | |
#(loop [coll % stk []] | |
(if (empty? coll) | |
stk | |
(recur (next coll) (cons (first coll) stk)))) |
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
;http://4clojure.com/problem/26 | |
#(loop [n % seq []] | |
(letfn [(fib [x] | |
(if (<= x 2) | |
1 | |
(+ (fib (- x 2)) (fib(- x 1)))))] | |
(if (= n 0) | |
seq | |
(recur (dec n) (cons (fib n) seq))))) |
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
;http://4clojure.com/problem/34 | |
#(loop [from %1 to %2 c ()] | |
(if (= from to) | |
(reverse c) | |
(recur (inc from) to (conj c from)))) |
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
;http://4clojure.com/problem/32 | |
#(loop [col % c ()] | |
(if (empty? col) | |
(reverse c) | |
(recur (rest col) | |
(cons (first col) (cons (first col) c))))) |
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
#(loop [col % c ()] | |
(cond (empty? col) (reverse c) | |
(= (first col) (first c)) (recur (rest col) c) | |
:else (recur (rest col) (cons (first col) c)))) |
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
;http://4clojure.com/problem/42 | |
#(loop [n % f 1] | |
(if (= n 1) | |
f | |
(recur (dec n) (* f n)))) |
OlderNewer