Skip to content

Commit 092ecc2

Browse files
committed
Add q76
1 parent e712f18 commit 092ecc2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/ex/q076.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/076
2+
3+
(ns ex.q076)
4+
5+
(defn ans
6+
"Problem 76, Intro to Trampoline"
7+
[]
8+
[1 3 5 7 9 11])

test/ex/q076_test.clj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
;; https://4clojure.oxal.org/#/problem/076
2+
3+
(ns ex.q076-test
4+
(:require [clojure.test :as t]
5+
[ex.q076 :as sut]))
6+
7+
(t/deftest test-q76
8+
(t/testing "Problem 76, Intro to Trampoline"
9+
(t/is (= (letfn
10+
[(foo [x y] #(bar (conj x y) y))
11+
(bar [x y] (if (> (last x) 10)
12+
x
13+
#(foo x (+ 2 y))))]
14+
(trampoline foo [] 1))
15+
(sut/ans)))))

0 commit comments

Comments
 (0)