Skip to content

Commit aaeefad

Browse files
Merge pull request #86 from kloimhardt/twotiles
add image, remove :draft flag
2 parents 6fa4025 + 4738ec3 commit aaeefad

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/games/twotiles_4clojure.clj

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
:clay {:title "4Clojure puzzles with twotiles"
33
:quarto {:author :kloimhardt
44
:type :post
5-
:draft true
65
:date "2025-09-25"
7-
:image ""
6+
:image "twotiles_4clojure.png"
87
:category :concepts
98
:tags [:blockly :graphical-programming]}}}
109

@@ -60,7 +59,7 @@
6059
ws
6160
(str code))))))
6261

63-
(md "To memorize this solution, complete the following set of graphical puzzles. The most fun is on mobile devices. Maybe you want to scroll through the workspaces first, to get the idea.")
62+
(md "To memorize this solution, complete the following set of graphical puzzles. This is most fun on mobile devices. Maybe you want to scroll through the workspaces first, to get the idea.")
6463

6564
^:kindly/hide-code
6665
(def add-pr1 (add-ws 'js/pr1))
@@ -123,19 +122,19 @@
123122
(kind/hiccup (create-ws "pr5" "300px"))
124123

125124

126-
(md "## 4Clojure #85: Powerset")
125+
(md "## 4Clojure Problem 85, Powerset")
127126

128127
(md "Write a function which generates the power set of a given set. The power set of a set x is the set of all subsets of x, including the empty set and x itself.")
129128

130129
(defn powerset
131130
[original-set]
132-
(reduce (fn [result e]
133-
(into result
134-
(map (fn [x]
135-
(conj x e))
136-
result)))
137-
(hash-set #{ })
138-
original-set))
131+
(-> (fn [result e]
132+
(into result
133+
(map (fn [x]
134+
(conj x e))
135+
result)))
136+
(reduce (hash-set #{ })
137+
original-set)))
139138

140139
(powerset (hash-set 1 2))
141140

@@ -155,10 +154,10 @@
155154
(str r "add_ps('" c "');"))
156155
""
157156
cs)}
158-
(str "Step number " (inc i))])
157+
(str "Step " (inc i))])
159158
tupels)))
160159

161-
(md "Again, complete a set of according puzzles step by step. This time, there is only one singe workspace. Start by clicking the first button.")
160+
(md "Again, complete the according puzzles step by step. This time, there is only one singe workspace. Start by clicking the first button.")
162161

163162
^:kindly/hide-code
164163
(kind/hiccup
@@ -173,9 +172,9 @@
173172
['(:tiles/vert (fn [result e] :tiles/slot))
174173
'(:tiles/vert (into :tiles/slot :tiles/slot))
175174
'result]
176-
['(:tiles/vert (reduce :tiles/slot :tiles/slot :tiles/slot))
175+
['(:tiles/vert (-> :tiles/slot :tiles/slot))
176+
'(:tiles/vert (reduce :tiles/slot :tiles/slot))
177177
'(hash-set #{})
178178
'original-set]]))
179179

180-
181180
(kind/hiccup (create-ws "ps" "500px"))

src/games/twotiles_4clojure.png

24.8 KB
Loading

0 commit comments

Comments
 (0)