practicalli

https://practicalli.github.io/ http://yt.vu/+practicalli (youtube)
Tom Spencer 2020-02-26T10:56:37.006100Z

Great! I look forward to the next one. This website is quite good: http://codingdojo.org/kata/ or this one for the videos?: https://katalyst.codurance.com/browse?query=TDD%20starter or could do exercism: https://exercism.io/my/tracks. Actually my vote would (humbly) be for exercism. I am loving the videos! Thank you so much!

Tom Spencer 2020-02-26T10:57:55.006800Z

I wondered if I could also ask a question. It was a great session yesterday at Thoughtworks. Our group did Tic Tac in Clojure: https://github.com/TomSpencerLondon/Clojure-Tic-Tac-Toe I am being a bit slow on this code: https://github.com/TomSpencerLondon/Clojure-Tic-Tac-Toe/blob/master/src/tic_tac_toe/core.clj#L16

Tom Spencer 2020-02-26T10:58:57.007900Z

I understood defn game and defn full-row and first two lines of check. Just wondering about lines 20 and 21 in check method.

yogidevbear 2020-02-26T12:22:08.015Z

@tomspencerlondon from the looks of it, row 20 is passing the diagonal values (top left, middle, bottom right) to the full-row function, and line 21 is doing the other diagonal (top right, middle, bottom left)

šŸ˜Ž 1
yogidevbear 2020-02-26T12:22:45.015900Z

If you imaging your board as:

[[:a1 :a2 :a3]
 [:b1 :b2 :b3]
 [:c1 :c2 :c3]]

yogidevbear 2020-02-26T12:23:26.016500Z

(map #(nth (second %) (first %)) (map-indexed vector [[:a1 :a2 :a3] [:b1 :b2 :b3] [:c1 :c2 :c3]])) will give you (:a1 :b2 :c3) and (map #(nth (second %) (- 2 (first %))) (map-indexed vector [[:a1 :a2 :a3] [:b1 :b2 :b3] [:c1 :c2 :c3]])) will give you (:a3 :b2 :c1)

Tom Spencer 2020-02-26T12:31:10.019800Z

Great. Thanks @yogidevbear! Then we call full-row on this result to assess if there is a full vector. This is useful. So that means this one:

(full-row (map #(nth (second %) (- 2 (first %))) (map-indexed vector board)))
is assessing the middle row. Thanks again.

yogidevbear 2020-02-26T12:32:26.020400Z

No, so my understanding is that that example is assessing the diagonal from top right to bottom left

yogidevbear 2020-02-26T12:32:36.020700Z

[[- - x]
 [- x -]
 [x - -]]

yogidevbear 2020-02-26T12:32:59.021100Z

@tomspencerlondon ā˜ļø

Tom Spencer 2020-02-26T12:33:45.021500Z

Oh right. I think Iā€™m getting it.

yogidevbear 2020-02-26T12:34:44.022400Z

If I test the following in my repl:

(map #(nth (second %) (- 2 (first %))) (map-indexed vector [[:- :- :x] [:- :x :-] [:x :- :-]]))
I get (:x :x :x)

Tom Spencer 2020-02-26T12:35:37.023600Z

Cool. Yes. I need to run these properly in the repl.

šŸ‘ 1
yogidevbear 2020-02-26T12:35:39.023700Z

I always find breaking these things down into their smaller parts and running each this with a tangible example directly in my repl helps to clear up what each individual part is doing

šŸ‘ 2
Tom Spencer 2020-02-26T12:35:49.024100Z

Thanks for the feedback this is helpful!

šŸ‘ 1
yogidevbear 2020-02-26T12:36:37.024800Z

Wish I'd been able to make it last night. Will hopefully be at the next one though šŸ™‚

Tom Spencer 2020-02-26T12:37:57.025100Z

Excellent! Look forward to seeing you there!

practicalli-john 2020-02-26T20:08:13.026600Z

@tomspencerlondon http://Exercism.io is something I would like to do more with. I also hope to find time to help them with version 3 of their Clojure curriculum and add it to ClojureBridge.