Skip to content

Commit 906c84a

Browse files
committed
Add q61
1 parent 633e722 commit 906c84a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/ex/q061.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
;; https://4clojure.oxal.org/#/problem/061
2+
3+
(ns ex.q061)
4+
5+
(defn ans
6+
"Problem 61, Map Construction. restriction: zipmap"
7+
[k v]
8+
(into {} (map #(vector %1 %2) k v)))

test/ex/q061_test.clj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
;; https://4clojure.oxal.org/#/problem/061
2+
3+
(ns ex.q061-test
4+
(:require [clojure.test :as t]
5+
[ex.q061 :as sut]))
6+
7+
(t/deftest test-q61
8+
(t/testing "Problem 61, Map Construction"
9+
(t/is (= {:a 1, :b 2, :c 3} (sut/ans [:a :b :c] [1 2 3])))
10+
(t/is (= {1 "one", 2 "two", 3 "three"} (sut/ans [1 2 3 4] ["one" "two" "three"])))
11+
(t/is (= {:foo "foo", :bar "bar"} (sut/ans [:foo :bar] ["foo" "bar" "baz"])))))

0 commit comments

Comments
 (0)