Skip to main content
Fix indentation
Source Link
obmarg
  • 678
  • 3
  • 11

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
       sample-board))

Using map like this will return things in sequences rather than vectors like the input data. If it's particularly important that you get vectors out you can always use mapv

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
  sample-board))

Using map like this will return things in sequences rather than vectors like the input data. If it's particularly important that you get vectors out you can always use mapv

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
       sample-board))

Using map like this will return things in sequences rather than vectors like the input data. If it's particularly important that you get vectors out you can always use mapv

Add mapv note
Source Link
obmarg
  • 678
  • 3
  • 11

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
  sample-board))

Using map like this will return things in sequences rather than vectors like the input data. If it's particularly important that you get vectors out you can always use mapv

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
  sample-board))

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
  sample-board))

Using map like this will return things in sequences rather than vectors like the input data. If it's particularly important that you get vectors out you can always use mapv

Source Link
obmarg
  • 678
  • 3
  • 11

You could maybe make your solution a bit neater by using a lambda in place of one of your partials. assoc might be a little clearer in purpose than a conj as well:

(def sample-board-solved
  (map (partial map #(assoc % :explored true))
  sample-board))