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
Post a Comment