practicalli

https://practicalli.github.io/ http://yt.vu/+practicalli (youtube)
2020-11-11T19:13:09.149300Z

Exercism request: Fancy showing us how to do Spiral Matrix (https://exercism.io/my/solutions/b123ac5f8a0c4fe9946b314bb724febc). This is the first Exercism problem that I can’t figure out how to do in Clojure. It looks like it’d be pretty straightforward in an imperative language but I can’t figure out how you’d solve this in a functional way. (Even though there are lots of solutions on Exercism, none of them actually make sense to me!)

practicalli-john 2020-11-12T11:02:55.149500Z

Sure, so long as I understand how to do it myself 😁 I'll take a look today and let you know how I get on. Thanks.

practicalli-john 2020-11-12T12:25:13.152800Z

Its doesn't seems as scary as it first looks 🙂 I think with a bit of partitioning, mapping, reducing and cycling it should create a nice functional approach. I'll try get this ready for Saturday (no promises though)

2020-11-12T12:59:22.153Z

Your functional programming skills are clearly pretty good… I’d be really interested to learn how to do it 😺

practicalli-john 2020-11-13T16:51:13.153200Z

Solving the Spiral Matrix challenge in a functional way is a lot easier when you think about generating the index in which numbers should be placed, rather than trying to generate numbers in the right order. Hopefully the trick I am using will be made clear in the broadcast... should be an interesting one 🙂

2020-11-13T17:10:33.153400Z

nice

practicalli-john 2020-11-13T23:18:30.155200Z

The code I'm covering tomorrow is shared on GitHub https://github.com/practicalli/exercism-clojure-guides/tree/master/spiral-matrix There is a functional approach (although its not beautiful) and a recursive function approach.

😺 1