Code for Space Age challenge is at https://github.com/practicalli/exercism-clojure-guides/tree/master/space-age
Thanks for the session today, greatly appreciated 👍😀
👍 Thanks John, much appreciated.
FYI my solution (which I refactored to within an inch of its life) is here: https://exercism.io/my/solutions/c086e2903b3c46f9b4647b9775637e7f … I ended up making a higher order function that returns a lambda that, in turn, computes the age on different planets.
Its a great solution, really like this. Unless its under a restrictive copywright, it would be a good example for the Practicall Clojure book 🙂
You’re more than welcome to use it!
Looking at other people’s solutions to this problem, some people took that idea even further… there are great solutions that e.g.:
• use partial
to avoid the need to return an fn
• do clever meta-programming tricks (that i need to learn) to convert a keyword to a symbol so that you don’t need to repeat the name… check out this one https://exercism.io/tracks/clojure/exercises/space-age/solutions/07c4952a06aa4c87aab7d745fda87a78 … it is my hope that I will one day know Clojure well enough to stuff like this (and wise enough to know when to use this power and when not to)
I avoid clever meta-programming tricks unless its the only way (which it rarely is) 🙂 macros and meta-programming tricks I leave for others to have a maintenance hangover with...