Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 37a5dbd2a2
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (16 sloc) 0.891 kB
<p>Yay! It works!</p>
<p>
By now, you probably think that Clojure is very different from the programming languages you already know.
Indeed, it belongs to a different family than most popular languages' - the family of "functional" programming languages.
Like most functional languages, Clojure can define a function without even giving it a name:
</p>
<code class="expr">(fn [x] (* x x))</code>
<p>
If you run this code, you'll see some cryptic output.
In Clojure, functions are just normal values like numbers or strings.
<code>fn</code> defines a function and then returns it.
What you're seeing is simply what a function looks like when you print it on the screen.
</p>
<p>
But wait - an anonymous function isn't very useful if you can't call it. Try to define a new anonymous function and call it straight away: <code class="expr">((fn [x] (* x x)) 10)</code>.
</p>
Jump to Line
Something went wrong with that request. Please try again.