adventofcode

Happy Advent 2020! Please put answers in the pinned threads or create one if it does not exist yet. | https://github.com/adventofcode-clojurians/adventofcode-clojurians | Join the private leaderboard with code 217019-4a55b8eb
euccastro 2021-01-18T04:26:35.004300Z

screencast of ztellman's solution to day 17: https://www.youtube.com/watch?v=lU3awBr5C7E

euccastro 2021-01-18T04:27:46.004900Z

a somewhat cruel reaction to Robert Martin's: https://www.youtube.com/watch?v=umKbM5SwLq4

2021-01-18T05:17:00.005500Z

wtf how did it possibly take 2 hrs & 160 lines of code?

2021-01-18T05:17:33.006100Z

idk, I haven’t done it, but glancing at Zach’s solution, the difference is stark

2021-01-18T05:18:25.006800Z

I’m probably extra harsh on BM because he repeatedly gives terrible advice as if it were handed down from on high.

👍 2
➕ 1
2021-01-18T05:18:32.007100Z

(And, remarkably, people believe him.)

Christian 2021-01-18T09:09:21.007700Z

Took me a while to get from Robert to Bob as in RM to BM.

➕ 2
2021-01-18T12:30:32.008600Z

Uncle Bob makes me think of someone who learny programming 30 years ago, and still programs like its 30 years ago

2021-01-18T12:32:43.008900Z

i dont understand his popularity

roelof 2021-01-18T12:39:46.009600Z

What do your experts think of the videos of lamda island?

2021-01-18T12:40:18.010Z

im not an expert, but as a clojure beginner, i really liked lambda islands daily aoc videos

2021-01-18T12:40:52.010600Z

i learnt some neat things from them

roelof 2021-01-18T12:41:00.010900Z

I also but I do not know if I learned then good idiomatic clojure code

roelof 2021-01-18T12:41:10.011200Z

but I l like his explanations

Christian 2021-01-18T12:55:18.012600Z

UB has a lot of blog posts like these: https://blog.cleancoder.com/uncle-bob/2019/08/22/WhyClojure.html should they be taken with a grain of salt? I don't want to quote him in my paper, when the "scene" thinks he is not always on the best of paths

Mno 2021-01-18T13:35:05.014600Z

Still makes me happy that he likes it, because it bodes well that if someone could convince Uncle Bob that it’s nice.. then it’s possible to convince just about anyone 😅. Also since he does garner attention it did give some attention to Clojure in general which I always appreciate

Mno 2021-01-18T13:41:42.020800Z

Uncle Bob has a lot of firm opinions based on a mix between experience and the dogmatic belief that programmers are engineers that should be held to similar rigorous standards, which makes him prefer ideas like Test Driven Development. His vocality and personality make him seem a little confrontational/adversarial to those who prefer to keep discussion open, and so that’s what I believe causes the main pushback against him. Personally I’d probably use him if I could use him to demonstrate that a diverse group of people (including him) agree on a topic. Also I’m ending this rant here because it’s a bit off-topic for the channel.

2021-01-18T14:47:26.021Z

No.

2021-01-18T14:47:31.021200Z

He gives terrible advice.

2021-01-18T14:47:43.021600Z

And his adherents pretend like it’s The Good Advice.

2021-01-18T14:48:25.022500Z

It has little to do with “his vocality and personality,” (which, as you say, are grating).

roelof 2021-01-18T14:48:25.022600Z

it that the same uncle Bob from c# ?

2021-01-18T14:48:42.023Z

pretty sure there’s only one 🙂

2021-01-18T14:50:46.023500Z

C# ? I would have thought Uncle Bob was known for Java / C++ more than C#. I must've missed his C# period

2021-01-18T14:54:09.024500Z

Not to mention the fact that he also happens to be a total jerk.

roelof 2021-01-18T14:54:32.025100Z

no idea. nver met him

2021-01-18T14:54:50.025900Z

I’ve seen him sic his followers on my friends because he didn’t like a decision that he knew absolutely nothing about.

2021-01-18T14:55:34.026900Z

All because of his personal crusade against “SJWs.”

roelof 2021-01-18T14:56:02.027500Z

and what are sjws ??

2021-01-18T14:56:16.028Z

"Social Justice Warriors"

2021-01-18T14:56:43.028700Z

I think he got cancelled from a conference after a controversal twitter post.

euccastro 2021-01-18T14:56:52.029Z

to be fair, it's easy to spend an indefinite length of time in an AoC challenge if you miss the key insight. that says little about the soundness (or otherwise) of his methodology

➕ 3
2021-01-18T14:57:04.029300Z

yeah, some of the challenges this year took me a good few hours!

2021-01-18T14:57:36.030300Z

I just had a blind spot on the insight on a few of them and ended up going down all sort of wrong rabbit holes

2021-01-18T14:58:02.031200Z

Yeah, my initial statement had nothing to do w/ the problem. I didn’t do it. I just glanced at Zach’s solution.

euccastro 2021-01-18T14:58:04.031300Z

personally I find it nuts to use TDD for AoC challenges unless you want to get specific practice on that or show it off, but I doubt that accounts for the time overhead

2021-01-18T14:58:41.032Z

So it was more, “Dude A took 20min. wtf took 2 hrs?”

2021-01-18T14:59:07.033Z

Didn’t mean to say everybody should take 20min.

euccastro 2021-01-18T14:59:41.034Z

I haven't seen this screencast by Uncle Bob, but I bet it's failing to realize that an infinite space calls for a sparse representation

euccastro 2021-01-18T14:59:53.034600Z

something that Zach jumped to immediately

roelof 2021-01-18T15:00:11.035300Z

I can image that for some days I will take maybe multiple days because im a beginnner in clojure

euccastro 2021-01-18T15:00:54.036700Z

I've seen people in this channel struggle with that, then come out with brilliant solutions in other challenges

2021-01-18T15:01:15.037400Z

@roelof, 'im the same. BUt its good to solve the problem and then come here / youtube to see other good clojure developers solution. You can learn a lot of useful functions that I find I often end up implementing myself because I didn't know they existed

roelof 2021-01-18T15:01:26.037700Z

I hear now things I never heard before like sparse represantation

euccastro 2021-01-18T15:03:28.039300Z

in some other challenge everyone seemed to get immediately that a mutable linked list was called for. I took forever to come up with a solution that run in 30+ minutes by just failing to think of that

2021-01-24T04:37:31.007700Z

FWIW, I agree that sparse storage is best, but immutable state is a must. I used maps since vectors puke on negative idxs. Also generate move increments for any sized dim. with math.combinatorics/selections is a real time saver. Finally, the key for speed is to only use neighbours to scan for next state, use ‘iterate to produce states et voilà. I spent time to write a rendering module to go through each cycle against the sample diagrams. It took 2 days but was a lot of fun. For me by far the hardest was fay 13 so far, currently on day 18. Cheers!

euccastro 2021-01-26T13:20:23.008500Z

yes, I don't know how one would solve 13 without knowing about the Chinese Remainder theorem

2021-01-28T21:06:52.009300Z

Uncle Bob has an interesting video on day 13 with a simple and fast solution, which positions the cursor on the current bus Id, then skipping (next id number of items) ’til the next one lines up and so on.

1
euccastro 2021-02-01T00:40:17.009800Z

I'll check it out, thanks!

euccastro 2021-01-18T15:05:42.041Z

@roelof in the context of this challenge, sparse representation means that you only represent the cells that are active, not the whole space (which is impossible, since it's infinite) nor a "box" around the active cells

roelof 2021-01-18T15:06:20.041300Z

oke thanks

Mno 2021-01-18T16:06:49.041500Z

That sounds like something he would say about anyone else. I’m personally not confident enough to assert any advice is good or bad (or terrible in this case).

Mno 2021-01-18T16:08:24.041700Z

I can say I’m not very convinced by his ideas to be honest, and that I don’t believe they’re the great advice for most people and cases. But that depends more on context than what he’s saying outright.

Mno 2021-01-18T16:11:12.041900Z

That’s unfortunate, I see why you dislike the guy then.

Christian 2021-01-18T16:19:12.043400Z

I'm study CS at uni and we were asked to use Test Driven Development wherever possible because it is safe and secure and the code writes itself when you have the tests. Why is that bad in clojure? I always feel bad becuase I skip making tests

Mno 2021-01-18T16:27:12.044500Z

It’s not necessarily bad, it’s a strategy that has it’s tradeoffs. In the case of advent of code.. maintainability is not something that is strongly valued and which is what TDD is supposed to give you in return for writing more code (for testing).

2021-01-18T16:30:35.048300Z

Question's probably good fit for #testing 🙂 (Can one cross-post in slack? I don't see it)

Mno 2021-01-18T16:30:55.048600Z

In clojure in general tests and specs are used quite a bit, but REPL driven development or Data Driven Development are more common, for various possible reasons.

Mno 2021-01-18T16:31:23.049400Z

Good shout Max!

2021-01-18T17:10:11.050Z

There are upsides to TDD Proper (i.e. test first). There are upsides to having a test suite.

2021-01-18T17:12:49.050200Z

But things like, “safety” or “security” are the result of a lot of decisions, and the test suite is way down the list of important things.

pez 2021-01-18T17:25:13.053400Z

@roelof, without having read all messages since you asked about lamdaisland (aka @plexus) , for all I can tell, that is showing super-duper idiomatic Clojure coding, and coding habits you can take inspiration from with great benefits. The only thing I disagree with is that he is not using Calva. 😃

👍 2
😂 2
roelof 2021-01-18T17:26:50.054500Z

thanks, I saw also a teacher whch making and explained this but he does it totally a other way then plexus

roelof 2021-01-18T17:26:59.054800Z

@pez

pez 2021-01-18T17:34:12.056400Z

There is no One True Way, so might be perfectly valid both of them. But when I see Arne code I just want to be that good, all the time. I’m virtually drooling.

🤤 1
roelof 2021-01-18T17:41:40.056900Z

I can image, I tried to follow him and I cannot all the time

roelof 2021-01-18T17:42:00.057300Z

I saw one videoo where he uses bit-map things

Joe 2021-01-18T19:01:48.066700Z

> I'm study CS at uni and we were asked to use Test Driven Development wherever possible because it is safe and secure and the code writes itself when you have the tests. Why is that bad in clojure? I always feel bad becuase I skip making tests The test-first TDD approach does a lot of stuff, and one of them is creating short feedback loops between writing small pieces of code and running it to see if it works the way you think it does, which you don't otherwise have in a lot of languages. Clojure already has a built in, ubiquitous mechanism for that same thing: the REPL. So that benefit falls off a bit in Clojure. Not doing TDD doesn't imply you shouldn't have tests at all though, there are lots of other benefits of having a test suite. More generally where I see TDD fall down in practice is when it's used to try to 'discover' an algorithm. Bob's AoC videos I think have lots of good examples of this. Another is the infamous Ron Jeffries attempt to write a Sudoku solver. In cases like that it's much more effective just to think about the problem for a while, maybe with a pen and paper. TDD is too rigid/mechanistic.

☝️ 3