Last Updated: February 25, 2016
· runexec

Clojure - First-class Functions

What's a first-class function?
scroll to bottom for examples

From wikipedia - "In programming language design, a first-class citizen (also object, entity, or value), in the context of a particular programming language, is an entity that can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable.[1] In computer science the term reification is used when referring to the process (technique, mechanism) of making something a first-class object.[2]

The term was coined by Christopher Strachey in the context of “functions as first-class citizens” in the mid-1960s.[3]"

Examples of First-class Clojure Functions

(defn fn1stClass [& args]
      (fn [& _]
          (for [a args] 
               (str "First Class Arg: "

uu.database=> ((fn1stClass "Ryan Kelker"))
("First Class Arg: Ryan Kelker")

uu.database=> (def newFN (fn1stClass "Ryan Kelker"))

uu.database=> (newFN)
("First Class Arg: Ryan Kelker")
Say Thanks