Skip to content

Commit 47b863d

Browse files
author
Ilmari Vacklin
committed
Add toggle.
1 parent a890e79 commit 47b863d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/structured_data.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@
3333
(defn books->author-names [books]
3434
:-)
3535

36+
(defn toggle [a-set elem]
37+
:-)
38+
3639
; %________%

test/structured_data_test.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
(second-elements [[1 2] [2 3] [3 4]]) => [2 3 4]
2424
(second-elements [[1 2 3 4] [1] ["a" "s" "d" "f"]]) => [2 nil "s"])
2525

26+
(facts "toggle"
27+
(toggle #{:a :b :c} :d) => #{:a :b :c :d}
28+
(toggle #{:a :b :c} :a) => #{:b :c})
29+
2630
(def china {:name "China Miéville", :birth-year 1972})
2731

2832
(def octavia {:name "Octavia E. Butler"

0 commit comments

Comments
 (0)