Wednesday, July 20, 2016

Clojure (1) add two number

First time, I blog about Clojure.
IDE = Nightcode1.0.1

this code is from Clojure in action and I rewrited it.

With REPL I run.

Sum two values
hello.core=> (+ 1 2)
3

make function add two values
hello.core=> (defn my-add [op1 op2] (+ op1 op2))
#'hello.core/my-add

use add function
hello.core=> (my-add 1 2)
3

use add function
hello.core=> (my-add 1000000000000000000 300000000000000000000)
301000000000000000000N


No comments:

Post a Comment