PurelyFunctional.tv Newsletter 405: giving thanks
From OO to Clojure Workshop!
Watch my free workshop to help you learn Clojure faster and shift your paradigm to functional.
Issue 405 - November 30, 2020 · Archives · Subscribe
Clojure Tip 💡
I am thankful for you, dear readers, for being there all these year, for your comments and questions, and for allowing me to share my ideas.
I really appreciate the design of Clojure and Rich Hickey's leadership that helps bring that about.
I appreciate Clojure's data structures.
I am grateful for the Clojure community and the amazing ideas they spread that I learn from all the time.
I am grateful for the host of Lisp implementers and researchers that came before us who did much of the hard work to bring the industry as far as it has come.
I am thankful for the stable Clojure implementation. I rarely have to worry about upgrades.
Book update 👃
Still a few more revisions to do. But it's close. I can see over the hill.
You can buy Grokking Simplicity and use the coupon code TSSIMPLICITY for 50% off. You can buy it now and it will be shipped to you when it's printed. Thanks to those of you who have already purchased 😘
Upcoming presentation 📢
December 5th I am speaking at re:clojure 2020. The lineup of speakers looks amazing. It's all online so see if you can attend, too! Registration is free.
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.
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
- Boolean combinators - 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
Sequence and parallel combinators
I've been re-reading the Lambda, the ultimate... papers again for my podcast. These papers show how functions and function calls can model many of the imperative constructs in programming languages. One practical application of that is to build a compiler whose main construct is the function call, which is a common way to implement Scheme.
In this challenge, we'd like to make constructs for two kinds of execution: sequential and parallel.
Imagine we had actions
b, which are functions which depend on
when they are called. If we want them to run in order, meaning
b begins, we can create a new action
a>b, like so:
(def a>b (sequential a b))
We can then call
(a>b) to run them in the right order.
If we want them to run in parallel, we can similarly write:
(def a-b (parallel a b))
Then when we call
(a-b), they will run "at the same time".
Your task is to write
parallel, using threads (or
some other construct) if needed.
: devise a way to have return values that you can block on.
sequential should act like
do and return the return value of the
parallel should return both return values.
Please submit your solutions as comments to this gist. Discussion is welcome.