PurelyFunctional.tv Newsletter 333: Tool: rebel readline
Clojure Tool 🔨
Bruce Hauman's terminal repl is really slick. I like to think of it as 80% of the stuff you get from an IDE without having to get repl integration working. It's got syntax highlighting, paren matching, really nice history, and autocompletion.
At least 10% of the last 20% shouldn't be too hard. Imagine if we had rebel readline with auto-compilation and auto-testing. Someone could edit code in their favorite text editor and switch to the rebel readline repl where their changes were immediately available.
That would be about 90% of the repl-driven development experience without requiring a change to the IDE. Someone who was just trying out Clojure could get a good feeling for what it is like to develop with it without committing to a weekend of IDE setup. What do you think?
Brain skill 😎
make an artifact
People like to make things. It's something we do. Making a thing real forces organization of ideas that can be very messy and unclear in your head. Putting the ideas into matter reveals the clutter, the unnecessary, the disorder. Then you can make it better.
When you're learning something, make your own learning aids. Make a cheat sheet for yourself. It will force you to clear up your understanding. Make a blog post. Clean up your ideas. Make a picture or diagram. Tidy up your mind.
Currently recording 🎥
I just started a new course called Property-Based Testing with test.check. Property-based testing (PBT) is a powerful tool for generating tests instead of writing them. I love the way it makes me think about my software, and I think you will, too.
That's why I'm excited about this course. PBT will find more bugs, give you more confidence in your code, and help your functional design much more than example-based testing does. If you like TDD, PBT is 10x that.
And if you don't believe me, would you believe Rich Hickey? test.check, Clojure's PBT library, is used by Clojure Spec. And there have been two [1, 2] invited talks to Clojure conferences about property-based testing. Property-based testing is important in Clojure.
Enough of selling PBT! Let me tell you about the five lessons I recorded this week:
- What is Property-Based testing?* free!
- What is test.check?
- Advantages of Property-Based Testing?
- When can you use Property-Based Testing
- How does Property-Based Testing work? also free!
I've made the first and fifth lessons free to watch. Go check them out.
Members already have access to the lessons. I'll open the Early Access Program next week. There is already 50 minutes of video, and looking at my plan, this one might be 5-6 hours. But that's just an estimate. It could be more or less.
Clojure Challenge 🤔
Last week's challenge
The puzzle in Issue 332 was to discover anagrams of a given word in a dictionary.
I got some great submissions. You can check them out here.
I liked the variety. Some were simple, some went deep on optimization. I love it.
This week's challenge
Detecting is one word is an anagram of another is easy. This time, we're going to do multi-word anagrams. Here's the problem:
Two phrases are anagrams if they contain the same letters rearranged, ignoring spaces. You should also ignore case.
- "School master" is an anagram of "The classroom"
- "As tronomer" is an anagram of "Moon starer"
- "The eyes" is an anagram of "They see"
So, two parts:
- Write a function to determine if two phrases are anagrams.
- Given a dictionary of words (such as this one, different from last week), take a phrase and generate anagrams of that phrase that contain one or more words from the dictionary.
For instance, if I give you the phrase "funeral", you should be able to generate, among others, "real fun".
Remember, the generated anagrams have to use all the letters.
As usual, please send me your answers. I'll share them all in next week's issue. If you send me one, but you don't want me to share it publicly, please let me know.
Rock on! Eric Normand