nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: ocaml-ppx/ppx_deriving
Pull request #285 (2024-04-26 14:17:43)

Fix the ordering of `make`'s arguments
I introduced a bug in `ppx_deriving.make` when working on #281 and inadvertently changed the ordering of the arguments of the generated function.

The test suite failed to pick it up because the signature was also generated with `[@@deriving make]` and the ordering was swapped in both the signature and structure derivers.

I added a module with a handwritten signature and a derived implementation so that this can't happen again in the future.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6282503..c599ed6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+unreleased
+----------
+
+* Fix ordering of derived `make`'s arguments
+  #285
+  (@NathanReb)
+
 6.0.1 (17/04/2024)
 ------------------
 
diff --git a/src_plugins/make/ppx_deriving_make.ml b/src_plugins/make/ppx_deriving_make.ml
index cd4545c..5e56af8 100644
--- a/src_plugins/make/ppx_deriving_make.ml
+++ b/src_plugins/make/ppx_deriving_make.ml
@@ -97,7 +97,9 @@ let str_of_record_type ~quoter ~loc labels =
       | None ->
         record fields
     in
-    List.fold_left (add_str_label_arg ~quoter ~loc) fn labels
+    (* The labels list must be reversed here so that the arguments are in the
+       same order as the record fields. *)
+    List.fold_left (add_str_label_arg ~quoter ~loc) fn (List.rev labels)
 
 let str_of_type ({ ptype_loc = loc } as type_decl) =
   let quoter = Ppx_deriving.create_quoter () in
@@ -156,7 +158,9 @@ let sig_of_record_type ~loc ~typ labels =
       | None when has_option -> Typ.arrow Label.nolabel (tconstr "unit" []) typ
       | None -> typ
     in
-    List.fold_left add_sig_label_arg typ labels
+    (* The labels list must be reversed here so that the arguments are in the
+       same order as the record fields. *)
+    List.fold_left add_sig_label_arg typ (List.rev labels)
 
 let sig_of_type ({ ptype_loc = loc } as type_decl) =
   let typ = Ppx_deriving.core_type_of_type_decl type_decl in


Test patch:
diff --git a/src_test/make/test_deriving_make.ml b/src_test/make/test_deriving_make.ml
index 506f8aa..aad3c5c 100644
--- a/src_test/make/test_deriving_make.ml
+++ b/src_test/make/test_deriving_make.ml
@@ -64,6 +64,23 @@ end = struct
   [@@deriving show]
 end
 
+(* This module is here to test that the ordering of the arguments
+   match the order of the record fields declarations. *)
+module M2 : sig
+  type t =
+    { first : int
+    ; second : int
+    }
+
+  val make : first: int -> second: int -> t
+end = struct
+  type t =
+    { first : int
+    ; second : int
+    }
+  [@@deriving make]
+end
+
 let test_no_main ctxt =
   assert_equal ~printer:M.show_a
                { M.a1 = None; a2 = []; a3 = 42; a4s = 2, []; a5 = 1 }
Repository: exercism/clojure
Pull request #174 (2017-07-02 19:08:57)

Test the cipher for opposite direction rotation.
A true rotational cipher does not care whether one rotates forwards or backwards.  The solution should be tested for this case.


Patch:
diff --git a/exercises/rotational-cipher/src/example.clj b/exercises/rotational-cipher/src/example.clj
index d40e1b1..c55f89e 100644
--- a/exercises/rotational-cipher/src/example.clj
+++ b/exercises/rotational-cipher/src/example.clj
@@ -1,21 +1,27 @@
 (ns rotational-cipher)
 
-(def ^:private string (partial apply str))
+(defn ^:private spinner [s a]
+  (let [a (int a)
+        spin (fn [c] (mod (+ c s) 26))]
+    (fn [c]
+      (let [c (- (int c) a)]
+        (char (+ (spin c) a))))))
 
-(def ^:private lower-case "abcdefghijklmnopqrstuvwxyz")
+(defn ^:private upper-spinner [s]
+  (spinner s \A))
 
-(def ^:private upper-case (->> lower-case (map clojure.string/upper-case) string))
+(defn ^:private lower-spinner [s]
+  (spinner s \a))
 
-(def ^:private letters (into #{} (concat lower-case upper-case)))
+(defn ^:private cipher [spin]
+  (let [upper-spin (upper-spinner spin)
+        lower-spin (lower-spinner spin)]
+    (fn [c]
+      (cond
+        (Character/isUpperCase c) (upper-spin c)
+        (Character/isLowerCase c) (lower-spin c)
+        :default c))))
 
-(defn- rotater [shift]
-  (let [encoding (->> (cycle letters)
-                      (drop (* shift 2))
-                      (take 52)
-                      (zipmap letters))]
-    (fn [char] (get encoding char char))))
-
-(defn rotate [message shift]
-  (->> message
-       (map (rotater shift))
-       string))
+(defn rotate [text spin]
+  (let [cipher (cipher spin)]
+    (apply str (map cipher text)) ))


Test patch:
diff --git a/exercises/rotational-cipher/test/rotational_cipher_test.clj b/exercises/rotational-cipher/test/rotational_cipher_test.clj
index d711c26..3418218 100644
--- a/exercises/rotational-cipher/test/rotational_cipher_test.clj
+++ b/exercises/rotational-cipher/test/rotational_cipher_test.clj
@@ -23,12 +23,25 @@
 
   (testing "rotate spaces"
     (is (= (rotational-cipher/rotate "O M G" 5) "T R L")))
-  
+
   (testing "rotate numbers"
     (is (= (rotational-cipher/rotate "Testing 1 2 3 testing" 4) "Xiwxmrk 1 2 3 xiwxmrk")))
 
   (testing "rotate punctuation"
     (is (= (rotational-cipher/rotate "Let's eat, Grandma!" 21) "Gzo'n zvo, Bmviyhv!")))
 
+  (testing "rotate in the opposite direction"
+    (is (= (rotational-cipher/rotate "b" -1) "a")))
+
+  (testing "rotate in the opposite direction past first letter"
+    (is (= (rotational-cipher/rotate "B" -2) "Z")))
+
+  (testing "rotate in the opposite direction past letter count"
+    (is (= (rotational-cipher/rotate "B" -28) "Z")))
+
+  (testing "rotate forward then backwards the same number of steps"
+    (is (=  (rotational-cipher/rotate
+              (rotational-cipher/rotate "B" 28) -28) "B")))
+
   (testing "rotate all letters"
     (is (= (rotational-cipher/rotate "The quick brown fox jumps over the lazy dog." 13) "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."))))
Repository: exercism/clojure
Pull request #201 (2017-12-19 19:33:06)

two-fer: add to track
Add two-fer to clojure track as per [todo](http://exercism.io/languages/clojure/todo)


Patch:
diff --git a/config.json b/config.json
index 13eb5b1..84acfa0 100644
--- a/config.json
+++ b/config.json
@@ -9,6 +9,14 @@
       "unlocked_by": null,
       "uuid": "1378910d-9bec-4217-bd40-07a8967fa3ad"
     },
+    {
+      "core": false,
+      "difficulty": 1,
+      "slug": "two-fer",
+      "topics": null,
+      "unlocked_by": null,
+      "uuid": "91a1f32c-0dac-4c65-8a13-49da90d21520"
+    },
     {
       "core": false,
       "difficulty": 1,
diff --git a/exercises/two-fer/README.md b/exercises/two-fer/README.md
new file mode 100644
index 0000000..12aeecb
--- /dev/null
+++ b/exercises/two-fer/README.md
@@ -0,0 +1,19 @@
+# Two-fer
+
+`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
+
+```text
+"One for X, one for me."
+```
+
+When X is a name or "you".
+
+If the given name is "Alice", the result should be "One for Alice, one for me."
+If no name is given, the result should be "One for you, one for me."
+
+## Source
+
+This is an exercise to introduce users to basic programming constructs, just after hello World. [http://en.wikipedia.org/wiki/Two-fer](http://en.wikipedia.org/wiki/Two-fer)
+
+## Submitting Incomplete Solutions
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
diff --git a/exercises/two-fer/project.clj b/exercises/two-fer/project.clj
new file mode 100644
index 0000000..8d19a53
--- /dev/null
+++ b/exercises/two-fer/project.clj
@@ -0,0 +1,4 @@
+(defproject two-fer "0.1.0-SNAPSHOT"
+  :description "two-fer exercise."
+  :url "https://github.com/exercism/clojure/tree/master/exercises/two-fer"
+  :dependencies [[org.clojure/clojure "1.8.0"]])
diff --git a/exercises/two-fer/src/example.clj b/exercises/two-fer/src/example.clj
new file mode 100644
index 0000000..258c504
--- /dev/null
+++ b/exercises/two-fer/src/example.clj
@@ -0,0 +1,5 @@
+(ns two-fer)
+
+(defn two-fer 
+  ([] (str "One for you, one for me."))
+  ([name] (str "One for " name ", one for me.")))
diff --git a/exercises/two-fer/src/two_fer.clj b/exercises/two-fer/src/two_fer.clj
new file mode 100644
index 0000000..be7738f
--- /dev/null
+++ b/exercises/two-fer/src/two_fer.clj
@@ -0,0 +1,5 @@
+(ns two-fer)
+
+(defn two-fer [] ;; <- arglist goes here
+  ;; your code goes here
+)


Test patch:
diff --git a/exercises/two-fer/test/two_fer_test.clj b/exercises/two-fer/test/two_fer_test.clj
new file mode 100644
index 0000000..a1ac329
--- /dev/null
+++ b/exercises/two-fer/test/two_fer_test.clj
@@ -0,0 +1,12 @@
+(ns two-fer-test
+  (:require [clojure.test :refer [deftest is]]
+            two-fer))
+
+(deftest two-fer-test
+  (is (= "One for you, one for me." (two-fer/two-fer))))
+
+(deftest name-alice-test
+  (is (= "One for Alice, one for me." (two-fer/two-fer "Alice"))))
+
+(deftest name-bob-test
+  (is (= "One for Bob, one for me." (two-fer/two-fer "Bob"))))
Repository: exercism/clojure
Pull request #210 (2018-01-02 18:10:56)

Revert "revert two-fer"
This reverts commit 0850d77eb68e226437458495b365a34c145f32f8.

## Conflicts:
###	config.json - resolved


Patch:
diff --git a/config.json b/config.json
index e312281..415fa09 100644
--- a/config.json
+++ b/config.json
@@ -17,6 +17,14 @@
       "unlocked_by": null,
       "uuid": "a4bdbdfd-1db1-425c-a243-dd032dc7b93a"
     },
+    {
+      "core": false,
+      "difficulty": 1,
+      "slug": "two-fer",
+      "topics": null,
+      "unlocked_by": null,
+      "uuid": "91a1f32c-0dac-4c65-8a13-49da90d21520"
+    },
     {
       "core": false,
       "difficulty": 1,
@@ -585,4 +593,4 @@
   ],
   "foregone": [],
   "language": "Clojure"
-} 
+}
diff --git a/exercises/two-fer/README.md b/exercises/two-fer/README.md
new file mode 100644
index 0000000..12aeecb
--- /dev/null
+++ b/exercises/two-fer/README.md
@@ -0,0 +1,19 @@
+# Two-fer
+
+`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
+
+```text
+"One for X, one for me."
+```
+
+When X is a name or "you".
+
+If the given name is "Alice", the result should be "One for Alice, one for me."
+If no name is given, the result should be "One for you, one for me."
+
+## Source
+
+This is an exercise to introduce users to basic programming constructs, just after hello World. [http://en.wikipedia.org/wiki/Two-fer](http://en.wikipedia.org/wiki/Two-fer)
+
+## Submitting Incomplete Solutions
+It's possible to submit an incomplete solution so you can see how others have completed the exercise.
diff --git a/exercises/two-fer/project.clj b/exercises/two-fer/project.clj
new file mode 100644
index 0000000..8d19a53
--- /dev/null
+++ b/exercises/two-fer/project.clj
@@ -0,0 +1,4 @@
+(defproject two-fer "0.1.0-SNAPSHOT"
+  :description "two-fer exercise."
+  :url "https://github.com/exercism/clojure/tree/master/exercises/two-fer"
+  :dependencies [[org.clojure/clojure "1.8.0"]])
diff --git a/exercises/two-fer/src/example.clj b/exercises/two-fer/src/example.clj
new file mode 100644
index 0000000..258c504
--- /dev/null
+++ b/exercises/two-fer/src/example.clj
@@ -0,0 +1,5 @@
+(ns two-fer)
+
+(defn two-fer 
+  ([] (str "One for you, one for me."))
+  ([name] (str "One for " name ", one for me.")))
diff --git a/exercises/two-fer/src/two_fer.clj b/exercises/two-fer/src/two_fer.clj
new file mode 100644
index 0000000..be7738f
--- /dev/null
+++ b/exercises/two-fer/src/two_fer.clj
@@ -0,0 +1,5 @@
+(ns two-fer)
+
+(defn two-fer [] ;; <- arglist goes here
+  ;; your code goes here
+)


Test patch:
diff --git a/exercises/two-fer/test/two_fer_test.clj b/exercises/two-fer/test/two_fer_test.clj
new file mode 100644
index 0000000..a1ac329
--- /dev/null
+++ b/exercises/two-fer/test/two_fer_test.clj
@@ -0,0 +1,12 @@
+(ns two-fer-test
+  (:require [clojure.test :refer [deftest is]]
+            two-fer))
+
+(deftest two-fer-test
+  (is (= "One for you, one for me." (two-fer/two-fer))))
+
+(deftest name-alice-test
+  (is (= "One for Alice, one for me." (two-fer/two-fer "Alice"))))
+
+(deftest name-bob-test
+  (is (= "One for Bob, one for me." (two-fer/two-fer "Bob"))))
Repository: exercism/clojure
Pull request #223 (2018-05-05 19:22:28)

Issue #214: Update bob for ambiguous case
This commit updates the bob exercise to take into account the shouting
question case, which involves updating the readme, test, and example
solution.


Patch:
diff --git a/exercises/bob/README.md b/exercises/bob/README.md
index 54cc1d4..1755559 100644
--- a/exercises/bob/README.md
+++ b/exercises/bob/README.md
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
 
 He answers 'Whoa, chill out!' if you yell at him.
 
+He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
+
 He says 'Fine. Be that way!' if you address him without actually saying
 anything.
 
diff --git a/exercises/bob/src/example.clj b/exercises/bob/src/example.clj
index 7dffb95..fd4d2d4 100644
--- a/exercises/bob/src/example.clj
+++ b/exercises/bob/src/example.clj
@@ -10,8 +10,12 @@
 (defn- shouting?   [msg] (and (= msg (str/upper-case msg))
                               (has-letter? msg)))
 
+(defn- forceful-question? [msg]
+  (and (shouting? msg) (question? msg)))
+
 (defn response-for [input]
   (cond
+    (forceful-question? input) "Calm down, I know what I'm doing!"
     (silence?  input) "Fine. Be that way!"
     (shouting? input) "Whoa, chill out!"
     (question? input) "Sure."


Test patch:
diff --git a/exercises/bob/test/bob_test.clj b/exercises/bob/test/bob_test.clj
index 317b68e..2e774eb 100644
--- a/exercises/bob/test/bob_test.clj
+++ b/exercises/bob/test/bob_test.clj
@@ -20,7 +20,7 @@
          (bob/response-for "It's OK if you don't want to go to the DMV."))))
 
 (deftest responds-to-forceful-questions
-  (is (= "Whoa, chill out!"
+  (is (= "Calm down, I know what I'm doing!"
          (bob/response-for "WHAT THE HELL WERE YOU THINKING?"))))
 
 (deftest responds-to-shouting-with-special-characters
Repository: exercism/clojure
Pull request #251 (2018-08-30 12:59:34)

difference-of-squares: renamed square-of-sums to square-of-sum
In exercise "difference-of-sums", renamed `square-of-sums` to `square-of-sum` and `difference-of-sums` to `difference-of-squares`.


Patch:
diff --git a/exercises/difference-of-squares/src/difference_of_squares.clj b/exercises/difference-of-squares/src/difference_of_squares.clj
index 46d032a..5200bdc 100644
--- a/exercises/difference-of-squares/src/difference_of_squares.clj
+++ b/exercises/difference-of-squares/src/difference_of_squares.clj
@@ -8,6 +8,6 @@
   ;; your code goes here
 )
 
-(defn square-of-sums [] ;; <- arglist goes here
+(defn square-of-sum [] ;; <- arglist goes here
   ;; your code goes here
 )
diff --git a/exercises/difference-of-squares/src/example.clj b/exercises/difference-of-squares/src/example.clj
index 860b159..c67705e 100644
--- a/exercises/difference-of-squares/src/example.clj
+++ b/exercises/difference-of-squares/src/example.clj
@@ -5,8 +5,8 @@
 (defn sum-of-squares [n]
   (sum (map #(int (Math/pow % 2)) (range 0 (inc n)))))
 
-(defn square-of-sums [n]
+(defn square-of-sum [n]
   (int (Math/pow (sum (range 0 (inc n))) 2)))
 
 (defn difference [x]
-  (- (square-of-sums x) (sum-of-squares x)))
+  (- (square-of-sum x) (sum-of-squares x)))


Test patch:
diff --git a/exercises/difference-of-squares/test/difference_of_squares_test.clj b/exercises/difference-of-squares/test/difference_of_squares_test.clj
index e860a2d..2355c8f 100644
--- a/exercises/difference-of-squares/test/difference_of_squares_test.clj
+++ b/exercises/difference-of-squares/test/difference_of_squares_test.clj
@@ -2,29 +2,29 @@
   (:require [clojure.test :refer [deftest is]]
             [difference-of-squares :as dos]))
 
-(deftest square-of-sums-to-5
-  (is (= 225 (dos/square-of-sums 5))))
+(deftest square-of-sum-to-5
+  (is (= 225 (dos/square-of-sum 5))))
 
 (deftest sum-of-squares-to-5
   (is (= 55 (dos/sum-of-squares 5))))
 
-(deftest difference-of-sums-to-5
+(deftest difference-of-squares-to-5
   (is (= 170 (dos/difference 5))))
 
-(deftest square-of-sums-to-10
-  (is (= 3025 (dos/square-of-sums 10))))
+(deftest square-of-sum-to-10
+  (is (= 3025 (dos/square-of-sum 10))))
 
 (deftest sum-of-squares-to-10
   (is (= 385 (dos/sum-of-squares 10))))
 
-(deftest difference-of-sums-to-10
+(deftest difference-of-squares-to-10
   (is (= 2640 (dos/difference 10))))
 
-(deftest square-of-sums-to-100
-  (is (= 25502500 (dos/square-of-sums 100))))
+(deftest square-of-sum-to-100
+  (is (= 25502500 (dos/square-of-sum 100))))
 
 (deftest sum-of-squares-to-100
   (is (= 338350 (dos/sum-of-squares 100))))
 
-(deftest difference-of-sums-to-100
+(deftest difference-of-squares-to-100
   (is (= 25164150 (dos/difference 100))))
Repository: exercism/clojure
Pull request #259 (2018-10-11 06:49:00)

Proverb: align the test with README.
Solves #254.

The README shows last line as "And all for the want of a nail.".
The test requires the last line to be "And all for the want of a horseshoe nail.".


Patch:
diff --git a/exercises/proverb/src/example.clj b/exercises/proverb/src/example.clj
index c737e94..4bafab3 100644
--- a/exercises/proverb/src/example.clj
+++ b/exercises/proverb/src/example.clj
@@ -3,7 +3,7 @@
 
 (def subjects ["nail" "shoe" "horse" "rider" "message" "battle" "kingdom"])
 
-(def last-line "And all for the want of a horseshoe nail.")
+(def last-line "And all for the want of a nail.")
 
 (defn- line [[cause-subject effect-subject]]
   (format "For want of a %s the %s was lost." cause-subject effect-subject))


Test patch:
diff --git a/exercises/proverb/test/proverb_test.clj b/exercises/proverb/test/proverb_test.clj
index de09651..ed78074 100644
--- a/exercises/proverb/test/proverb_test.clj
+++ b/exercises/proverb/test/proverb_test.clj
@@ -11,4 +11,4 @@
                          "For want of a rider the message was lost."
                          "For want of a message the battle was lost."
                          "For want of a battle the kingdom was lost."
-                         "And all for the want of a horseshoe nail."]))))
+                         "And all for the want of a nail."]))))
Repository: exercism/clojure
Pull request #273 (2019-05-21 06:31:51)

fix function name collision exercism#253
Issue fix. #253 


Patch:
diff --git a/exercises/nucleotide-count/src/example.clj b/exercises/nucleotide-count/src/example.clj
index bc60809..82c4a85 100644
--- a/exercises/nucleotide-count/src/example.clj
+++ b/exercises/nucleotide-count/src/example.clj
@@ -1,5 +1,4 @@
-(ns nucleotide-count
-  (:refer-clojure :exclude [count]))
+(ns nucleotide-count)
 
 (def ^{:private :const} dna-nucleotides #{\A \C \G \T})
 
@@ -11,7 +10,7 @@
   [strand]
   (into base-count (frequencies strand)))
 
-(defn count
+(defn count-of-nucleotide-in-strand
   "count occurrences of nucleotide in strand"
   [nucleotide strand]
   (or ((nucleotide-counts strand) nucleotide)
diff --git a/exercises/nucleotide-count/src/nucleotide_count.clj b/exercises/nucleotide-count/src/nucleotide_count.clj
index 6c7ab1c..76f189f 100644
--- a/exercises/nucleotide-count/src/nucleotide_count.clj
+++ b/exercises/nucleotide-count/src/nucleotide_count.clj
@@ -1,9 +1,10 @@
 (ns nucleotide-count)
 
-(defn count [nucleotide strand] ;; <- Arglist goes here
+(defn count-of-nucleotide-in-strand [nucleotide strand] ;; <- Arglist goes here
   ;; your code goes here
 )
 
+
 (defn nucleotide-counts [strand] ;; <- Arglist goes here
   ;; your code goes here
 )


Test patch:
diff --git a/exercises/nucleotide-count/test/nucleotide_count_test.clj b/exercises/nucleotide-count/test/nucleotide_count_test.clj
index 9cdfa70..a5d512c 100644
--- a/exercises/nucleotide-count/test/nucleotide_count_test.clj
+++ b/exercises/nucleotide-count/test/nucleotide_count_test.clj
@@ -3,24 +3,24 @@
             nucleotide-count))
 
 (deftest empty-dna-strand-has-no-adenosine
-  (is (= 0 (nucleotide-count/count \A, ""))))
+  (is (= 0 (nucleotide-count/count-of-nucleotide-in-strand \A, ""))))
 
 (deftest empty-dna-strand-has-no-nucleotides
   (is (= {\A 0, \T 0, \C 0, \G 0}
          (nucleotide-count/nucleotide-counts ""))))
 
 (deftest repetitive-cytidine-gets-counted
-  (is (= 5 (nucleotide-count/count \C "CCCCC"))))
+  (is (= 5 (nucleotide-count/count-of-nucleotide-in-strand \C "CCCCC"))))
 
 (deftest repetitive-sequence-has-only-guanosine
   (is (= {\A 0, \T 0, \C 0, \G 8}
          (nucleotide-count/nucleotide-counts "GGGGGGGG"))))
 
 (deftest counts-only-thymidine
-  (is (= 1 (nucleotide-count/count \T "GGGGGTAACCCGG"))))
+  (is (= 1 (nucleotide-count/count-of-nucleotide-in-strand \T "GGGGGTAACCCGG"))))
 
 (deftest validates-nucleotides
-  (is (thrown? Throwable (nucleotide-count/count \X "GACT"))))
+  (is (thrown? Throwable (nucleotide-count/count-of-nucleotide-in-strand \X "GACT"))))
 
 (deftest counts-all-nucleotides
   (let [s "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"]
Repository: exercism/clojure
Pull request #433 (2021-09-18 19:44:34)

Fix failing exercises
* A recent update to the `queen-attack` tests caused the example solution to fail. I replaced it with a new implementation which passes.
* A unit test in `robot-name` had an error in it.


Patch:
diff --git a/exercises/practice/queen-attack/.meta/src/example.clj b/exercises/practice/queen-attack/.meta/src/example.clj
index 017a155..30c02c3 100644
--- a/exercises/practice/queen-attack/.meta/src/example.clj
+++ b/exercises/practice/queen-attack/.meta/src/example.clj
@@ -1,32 +1,28 @@
 (ns queen-attack
-  (:require [clojure.string :as str]
-            [clojure.set    :as set]))
+  (:require [clojure.string :as str]))
 
-(defn board-string [queens]
-  (let [piece-at (set/map-invert queens)]
-    (str/join "\n"
-              (map #(str/join " " %1)
-                   (conj (vec (partition 8
-                                         (for [x (range 8)
-                                               y (range 8)]
-                                           (.toUpperCase (name (or (piece-at [x y])
-                                                                   "_"))))))
-                         nil)))))
+(defn abs [n]
+  (if (neg? n) (- n) n))
 
-(defn same-row [queens]
-  (= (first (:w queens))
-     (first (:b queens))))
+(def empty-board
+  (->> ["_" "_" "_" "_" "_" "_" "_" "_"]
+       (repeat 8)
+       vec))
 
-(defn same-col [queens]
-  (= (last (:w queens))
-     (last (:b queens))))
+(defn board->str [board]
+  (->> board
+       (map #(str/join " " %))
+       (map #(str % "\n"))
+       (apply str)))
 
-(defn diagonal [queens]
-  (let [xdiff (- (first (:w queens)) (first (:b queens)))
-        ydiff (- (last  (:w queens)) (last  (:b queens)))]
-    (= xdiff ydiff)))
+(defn board-string [{:keys [w b]}]
+  (-> empty-board
+      (cond-> w (assoc-in w \W)
+              b (assoc-in b \B))
+      board->str))
 
-(defn can-attack [queens]
-  (or (same-row queens)
-      (same-col queens)
-      (diagonal queens)))
+(defn can-attack [{[wx wy] :w [bx by] :b :as state}]
+  (or (= wx bx)
+      (= wy by)
+      (= (abs (- wx bx))
+         (abs (- wy by)))))
\ No newline at end of file


Test patch:
diff --git a/exercises/practice/robot-name/test/robot_name_test.clj b/exercises/practice/robot-name/test/robot_name_test.clj
index 169ec56..addeb27 100644
--- a/exercises/practice/robot-name/test/robot_name_test.clj
+++ b/exercises/practice/robot-name/test/robot_name_test.clj
@@ -39,5 +39,9 @@
       (is (= its-new-name (robot-name/robot-name a-robot)))))
 
 (deftest new-names-different-each-time
+  (let [a-robot (robot-name/robot)
+        its-original-name (robot-name/robot-name a-robot)
+        its-new-name (do (robot-name/reset-name a-robot)
+                         (robot-name/robot-name a-robot))]
   (is (not= its-new-name (do (robot-name/reset-name a-robot)
-                             (robot-name/robot-name a-robot)))))
+                             (robot-name/robot-name a-robot))))))