Clojure

Clojure programming language history

Downloads

Clojure Tutorials

Try doing Coljure programming online

Comments

Apparently, Clojure, is a dialect of the Lisp programming language. Lisp is a programming language which uses lots of parenthesis: ((())), to surround source code with.

EXAMPLE CODES:-

Try typing in the following 1 line program codes; and, running them…

Print string literal text…

  • (println “Hello, world!”)

Do calculator sums…

  • (+ 3 3) ;*** this is a Clojure end of line comment: Output: 6
  • (- 3 3)
  • (* 3 3)
  • (/ 3 3)
  • (mod 4 3)
  • (+ 4 (* 3 2) (/ 6 2)) ; Output: 13
  • (* (* 1 2) 2); Output: 4

NOTE: You need to be very careful about the use of spaces within Clojure line statements; instead of returning back the sum result you wanted; the compiler will simply report an error…meaning it doesn’t understand…?!

Boolean expressions

  • (= 1 2)
  • (= 1 1)
  • (not true)
  • (and true false)
  • (or true false)

Defining; calculating with; and, printing numeric variables…

  • (def var1 3)
  • (def var2 4)
  • (+ var1 var2)

Defining and printing string variables…

  • (def greeting1 “Hello, “)
  • (def greeting2 “world!”)
  • (println greeting1 greeting2)

Commands help…

  • (doc def)
  • (source def)
Related articles

http://tryclj.com/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s