-
The new rake task assets:clean removes precompiled assets. [fxn]
-
Application and plugin generation run bundle install unless
--skip-gemfile
or--skip-bundle
. [fxn] -
Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]
-
Template generation for jdbcpostgresql #jruby [Vishnu Atrai]
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 'rake' | |
require 'rspec/core/rake_task' | |
RSpec::Core::RakeTask.new(:spec) | |
task :default => :spec |
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
(apply + | |
(filter #(or (= (mod % 3) 0) (= (mod % 5) 0)) | |
(range 1 1000))) |
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
;;; Project Euler Problem 1 | |
;;; http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%201 | |
;;; | |
;;; 10未満の自然数のうち、3 もしくは 5 の倍数になっているものは 3, 5, 6, 9 の4つがあり、 これらの合計は 23 になる。 | |
;;; 同じようにして、1,000 未満の 3 か 5 の倍数になっている数字の合計を求めよ。 | |
;;; 3 もしくは 5の倍数の場合 true、そうでない場合 false を返す filter 判定用関数 | |
(defn fizz-or-buzz? | |
"3か5で割り切れるならtrue、そうでないならfalseを返す。" | |
[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
(defn fib | |
"Returns the nth Fibonacci number." | |
^long | |
[n] | |
(-> (* 0.5 (inc (Math/sqrt 5))) ; golden ratio | |
(Math/pow n) | |
(/ (Math/sqrt 5)) | |
(+ 0.5) | |
Math/floor | |
long)) |
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
(apply + (filter #(or (zero? (mod % 3)) (zero? (mod % 5))) (range 1000))) |
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
;;; Project Euler Problem 3 | |
;;; http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%203 | |
(use 'clojure.test) | |
(defn prime? | |
[n] | |
(if (= 1 n) | |
false | |
(every? (complement #(zero? (rem n %))) |
#clojure 入門者向け勉強会 #mitori_clj 第二週担当分
Project Euler Problem 10
2,000,000 未満の素数の総和を求めよ. とのことです.
結果を出すために手に入るリソースを有効活用するという考えのもとでは --この問題自体の解答を述べている
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
(use 'clojure.set) | |
(defn n-multiples [n end] (set (range 0 end n))) | |
(defn solve [] | |
(apply + (union (n-multiples 3 1000) | |
(n-multiples 5 1000)))) |
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
;; seq-end-inclusive を割れそうな数の候補 | |
(defn denominators [seq-end-inclusive] | |
(for [d (range 2 (+ seq-end-inclusive 1)) | |
:while (<= (* d d) seq-end-inclusive) | |
] | |
d)) | |
;; end-inclusive 以下の素数列をエラトステネスの篩で | |
(defn gen-primes [end-inclusive] | |
(reduce (fn [primes d] (filter #(or (= %1 d) |
OlderNewer