Clojure: Calling function from script throws RuntimeException -


i'm newbie clojure world coming python background.

i have created clojure script problem_1.clj:

(defn first_element  [arg]  (println arg))  (first_element [1, 2]) 

i have installed clojure via sudo apt-get , running script

>> clojure problem_1.clj

error

exception in thread "main" java.lang.runtimeexception: unable resolve symbol: first_element in context, compiling:(/home/naveen/code/repos/clojure-scripts/problems/problem_1.clj:6:1) 

any appreciated, thanks.

you need add call namespace macro first thing in file. namespace should match name of file, except namespace should use -s, while file must not contain dashes; use _s instead. namespace should qualified enclosing namespaces; although that's not applicable here.

add (ns problem-1.clj) top of file, , check out its documentation


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -