PurelyFunctional.tv Newsletter 376: Learn from core
From OO to Clojure Workshop!
Watch my free workshop to help you learn Clojure faster and shift your paradigm to functional.
Clojure Tip 💡
Learn from core
For example, would I have written
frequencies myself if I wasn't used
to using it in Clojure? I'm sure I could have written it myself, given
the spec. But would I have thought of writing it? Would I have come up
with that spec? Clojure has changed the way I think. Changing the way
people think is the biggest impact Clojure will have on the industry.
Clojure has an excellent standard library. There is a lot to learn in the selection of functions it contains. This is essentially the message behind the book Clojure, The Essential Reference. In it, Renzo Borgatti walks through a huge portion of Clojure core. He's discovered a lot of great stuff and shared it in the book.
So that's my tip for the week: read core. There's a lot of good stuff there and it will make you a better programmer.
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, please 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.
Stay healthy. Wash your hands. Stay at home. Wear a mask. Take care of loved ones.
Clojure Challenge 🤔
Last week's challenge
You can leave comments on these submissions in the gist itself. Please leave comments! You can also hit the Subscribe button to keep abreast of the comments. We're all here to learn.
This week's challenge
Distance to nearest vowel
Write a function that takes a string as argument. Each character in the string will be a letter. The function should return a sequence containing the distances from each corresponding letter in the string to the nearest vowel in the string.
(nearest-vowels "aeiou") ;=> [0 0 0 0 0] ;; if the letter is a vowel, the distance is 0 (nearest-vowels "babbb") ;=> [1 0 1 2 3] (nearest-vowels "babbba") ;=> [1 0 1 2 1 0]
- All input strings will contain at least one vowel and all letters.
- Vowels are a, e, i, o, and u.
You can also find these same instructions here. I might update them to corre ct errors and clarify the descriptions. That's also where submissions will be posted.
As usual, please reply to this email and let me know what you tried. I'll collect them up and share them in the next issue. If you don't want me to share your submission, let me know.