4clojure 是一個非常棒的 Clojure 練習網站,可以在練習的過程中逐漸熟悉 clojure 的 核心命令以及常用函式。
這邊列出我最近重寫 4clojure 整理的資訊。
目前排名資訊:
Username: coldnew Rank: 1916 out of 38587 Problems Solved: 85
001: Nothing but the Truth
URL: https://www.4clojure.com/problem/1
This is a clojure form. Enter a value which will make the form evaluate to true.
Don't over think it! If you are confused, see the getting started page. Hint:
true is equal to true.
(= __ true)
點我顯示/隱藏內容
002: Simple Math
URL: https://www.4clojure.com/problem/2
If you are not familiar with polish notation, simple arithmetic might seem
confusing.
Note: Enter only enough to fill in the blank (in this case, a single number) -
do not retype the whole problem.
(= (- 10 (* 2 3)) __)
點我顯示/隱藏內容
003: Intro to Strings
URL: https://www.4clojure.com/problem/3
Clojure strings are Java strings. This means that you can use any of the Java
string methods on Clojure strings.
(= __ (.toUpperCase "hello world"))
點我顯示/隱藏內容
004: Intro to Lists
URL: https://www.4clojure.com/problem/4
Lists can be constructed with either a function or a quoted form.
(= (list __) '(:a :b :c))
點我顯示/隱藏內容
005: Lists: conj
URL: https://www.4clojure.com/problem/5
When operating on a list, the conj function will return a new list with one or
more items "added" to the front.
Note that there are two test cases, but you are expected to supply only one
answer, which will cause all the tests to pass.
(= __ (conj '(2 3 4) 1))
(= __ (conj '(3 4) 2 1))
點我顯示/隱藏內容
006: Intro to Vectors
URL: https://www.4clojure.com/problem/6
Vectors can be constructed several ways. You can compare them with lists.
Note: the brackets [] surrounding the blanks __ are part of the test case.
(= [__] (list :a :b :c) (vec '(:a :b :c)) (vector :a :b :c))
點我顯示/隱藏內容
007: Vectors: conj
URL: https://www.4clojure.com/problem/7
When operating on a Vector, the conj function will return a new vector with one
or more items "added" to the end. test not run
(= __ (conj [1 2 3] 4))
(= __ (conj [1 2] 3 4))
點我顯示/隱藏內容