Functional Programming is the hot new keyword in the coding world. Look! We’re Functional! However, I’m pretty sure most people jumping on the Functional Programming bandwagon have no idea where Functional Programming came from, why functional programming is important, or why the lowercase greek letter lambda is splashed all over the covers of Functional Programming books.
Never fear! This is your quick Functional Programming Primer. I’ll give you the 10,000 foot overview of the benefits of Functional Programming, along with its benefits, and even explain the origin of the lambda. Continue reading “Functional Programming Primer”
Clojure concurrency is easy with future. Speed improvements in Clojure on modern computers come from multi-threading. Besides tapping into Java’s thread system, Clojure has it’s own easy-to-use thread system, and Clojure threads don’t get easier to use than with future.
In its simplest form, use def with a future and then then dereference the value obtained. When the future is no longer needed, make a call to shutdown-agents for the program to exit properly.
"Doing something noticable."
"Life. Don't tell me about life.")
"I don't do a whole lot."
;; create a var named some-string
;; and make it reference our future
(def some-string (future
;; dereference the future value
;; and print it
;; remember to shut down agents
;; so the program exits normally
Continue reading “Clojure Threading with Future”