Posts

Showing posts from October, 2017

defining functions clojure

(defn saysomething
     " i dont want to talk to you"
     [name]
     (str "why is it so?" name))
#'my-clojureproject1.core/saysomething
=> (println (saysomething "anjana")


=> (defn saymorethings "what do you want to hear" [name] (str "life is a box of chocolates" name))
#'my-clojureproject1.core/saymorethings
=> (println (saymorethings "nirosha")
            )
life is a box of chocolatesnirosha

nil

Learning clojure day-1

;; Clojure 1.6.0
=> (count a[eee ttt tt])
CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core/count--inliner, compiling:(C:\Users\\AppData\Local\Temp\form-init7824848865457405872.clj:1:1)
=> (count [eee tt 565 dfsxf 889 dfgd])
CompilerException java.lang.RuntimeException: Unable to resolve symbol: eee in this context, compiling:(C:\Users\\AppData\Local\Temp\form-init7824848865457405872.clj:1:1)
=> (count ["aaa" "ddd" 56 45 ""])
5
=> (def storages["ssss" "sddsdsd" "333dsfsd"])
#'my-clojureproject1.core/storages
=> (first storages)
ssss
=> (second storages)
sddsdsd
=> (last storages)
333dsfsd
=> (nthext storages 2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: nthext in this context, compiling:(C:\Users\am055849\AppData\Local\Temp\form-init7824848865457405872.clj:1:1)
=> (nthnext storages 2)
("333dsfsd")
=> (nthnext storages 1)
(…