Code Snippets/Clojure2010. 10. 8. 19:31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
; Problem 1
; Find the sum of all the multiples of 3 or 5 below 1000.
; - below 10 : 3, 5, 6, 9 >> 23
 
(defn multiples? [x y]
  (zero? (rem x y)))
 
(defn sum-of-all-the-multiples [x y below]
  (reduce +
    (filter
      #(or
         (multiples? % x)
         (multiples? % y))
      (range below))))
SyntaxHighlighter에 Clojure용 js가 아직은 없어서, 간단하게 만들었습니다.
License는 'Dual licensed under the MIT and GPL licenses'이니 코드 공개하면 배포 및 수정이 가능하다고 하네요.
(http://www.opensource.org/licenses/mit-license.php http://likedawn.tistory.com/9)

shBrushClojure.js
현재는 간단하게 주석과 키워드만 적용 되어 있습니다.
shTemeDefault.css
string의 색을 변경했습니다. blue -> 분홍(?)

'Code Snippets > Clojure' 카테고리의 다른 글

[Project Euler] Problem 8  (0) 2010.10.14
[Project Euler] Problem 2  (0) 2010.10.11
Clojure Sample - Sequence  (0) 2010.10.08
Clojure Sample - Function  (0) 2010.10.08
Clojure Sample - Basic  (0) 2010.10.07
Posted by codevania