Functional Programming Primer

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”

Calling ClojureScript from JavaScript

Integrating JavaScript and ClojureScript into a single web page is easy, with the right start. JavaScript is the language of the web, for now anyway. However sometimes, you want a more modern, powerful language. Perhaps a language that combines modern functional paradigms with the old school power of Lisp. ClojureScript fits your needs.

ClojureScript is a modern functional Lisp that happens to compile down to optimized JavaScript. The base language is called Clojure. Clojure targets the JVM, .NET, and JavaScript VMs. ClojureScript is the JavaScript variety of Clojure.

Continue reading “Calling ClojureScript from JavaScript”

Calling Custom Clojure Functions from Java

Calling Clojure APIs from Java is discussed in my first tutorial. This tutorial explores calling your own Clojure functions from Java. A common use case for this is when you write a JavaFX UI and want to have the controller code written in Clojure.

Our first example explains how to call a simple Clojure function that takes no arguments and returns no values. (Technically, all Clojure fuctions return values, but that doesn’t mean we care about all values Clojure functions return.)

(ns java-clj-interop.core)

(defn hello-world
  "Yeah. You guessed it. This prints 'Hello World!'"
  []
  (println "Hello World!"))

Continue reading “Calling Custom Clojure Functions from Java”