PurelyFunctional.tv Newsletter 411: is it easier after Clojure?
Design Tip 💡
is it easier after Clojure?
I put in the last issue was about sequence manipulation. It was
considered hard in Java by the challenge site I found it on. Many people
submitted answers. There was almost a consensus on a two-line solution
One person tried it in
public class . . . boilerplate, the method itself is only
2 lines long. But I do think it's got some advanced stuff in it.
I don't think I have an answer to the question myself. But ever since I started issuing challenges, I've asked myself whether these challenges really are hard or very hard or expert level. Week after week, I've seen people tackle these problems using Clojure, most of the time without breaking a sweat.
Allow me to ask the question to you, dear reader. Here are various versions of the question, all circling around the main issue:
- Are these challenges really hard? That is, are they categorized correctly?
- Maybe these challenges are easy for only a small portion of my 3,500 person email list. Do the others find them challenging?
- Am I cherry-picking the easy problems from the hard category?
- Does Clojure teach you to solve problems better, even in other languages?
I think all of these are true, to some extent. But I really want #5 to be true. In my own experience, the process of learning Clojure has made me write code in other languages very differently.
Very often, when approaching challenges myself in another language, I
find myself writing helper functions that already exist in Clojure. For
instance, I often write
frequencies for counting the items in an
array. It makes solving the problem easier. It's not technically a
one-liner, but each part was easy to write. And the parts are reusable.
I learned to do that because I learned Clojure. Clojure taught me to think in data. It taught me to think in small pieces. And it showed me a huge library of functions that are general-purpose and easy to write.
Incidentally, this is one of the hidden premises of my book. I want to teach everyone what Clojure taught me, without having to teach Clojure as an intermediary.
So I want to ask you: what has Clojure taught you? Please hit reply and let me know. I may share the answers I get in the next issue.
State of Clojure Community Survey 📋
Please support the ongoing development of Clojure by filling out the annual survey. There are still a few days left.
This survey has been going on for years and it collects very important statistics on the Clojure community. I find the information valuable myself. I can only imagine how important it would be for the folks in Clojure's core team to know this stuff.
Please fill it out, regardless of how you use Clojure. It's all great information.
This week on the podcast, I read Computing Then and Now, the 1967 ACM Turing Award lecture from Maurice Wilkes. It's a great lecture with lots of great anecdotes from the early days of computing and lots of predictions for what was to come.
Quarantine update 😷
I know a lot of people are going through tougher times than I am. If you, for any reason, can't afford my courses, and you think the courses will help you, ple ase hit reply and I will set you up. It's a small gesture I can make, but it might help.
I don't want to shame you or anybody that we should be using this time to work on our skills. The number one priority is your health and safety. I know I haven't been able to work very much, let alone learn some new skill. But if learning Clojure is important to you, and you can't afford it, just hit reply and I'll set you up. Keeping busy can keep us sane.
Also, if you just want to subscribe for a paid membership, I have opened them back up for the moment. Register here.
Stay healthy. Wash your hands. Wear a mask. Take care of loved ones.
Clojure Challenge 🤔
Last issue's challenge
- Nested lists - submissions
Please do participate in the discussion at the submission links above. It's active and it's a great way to get comments on your code.
This week's challenge
Least common multiple
Find the least common multiple of an array of integers. That is, find the smallest positive integer that is evenly divisible by all of the integers in the array.
(lcm [1 2 3]) ;=> 6 (lcm [5 4 4]) ;=> 20 (lcm ) ;=> 1 (lcm ) ;=> 10
Please submit your design process as comments to this gist. Discussion is welcome.