This is my solution to the Gigasecond problem in Clojure.
To solve it I had to learn first how to add days to a date in Java by having a look to the SimpleDateFormat and Calendar classes.
Then I learned a bit about how to use Java from Clojure in the Clojure Java Interop documentation and this other useful post: Calling java from Clojure.
Finally, once I had it working on the REPL, I added some private helper functions and used the -> macro in the implementation of the from function to make the code more readable.
You can nitpick my solution here or see all the exercises I've done so far in this repository.
No comments:
Post a Comment