Last active
November 6, 2015 02:20
-
-
Save joshuakfarrar/9e2b8bf7525402c4eac5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# repl | |
cljs.user> (defn greet [name] (.log js/console (str "Hello, " name "!"))) | |
cljs.user> (greet "Sent1nel") | |
Hello, Sent1nel! | |
# shell, using clojure1.6 from debian project | |
zipp@stormwind:~/clojure$ cat hello.clj | |
(defn greet [name] | |
(if-not (clojure.string/blank? name) | |
(println (str "Hello, " name "!")) | |
(throw (IllegalArgumentException. "Must have a name!")))) | |
(greet (nth *command-line-args* 0)) | |
zipp@stormwind:~/clojure$ clojure hello.clj boink | |
Hello, boink! | |
zipp@stormwind:~/clojure$ clojure hello.clj | |
Exception in thread "main" java.lang.IllegalArgumentException: Must have a name!, compiling:(/home/zipp/clojure/hello.clj:4:60) | |
at clojure.lang.Compiler.load(Compiler.java:7145) | |
at clojure.lang.Compiler.loadFile(Compiler.java:7089) | |
at clojure.main$load_script.invoke(main.clj:274) | |
at clojure.main$script_opt.invoke(main.clj:336) | |
at clojure.main$main.doInvoke(main.clj:420) | |
at clojure.lang.RestFn.invoke(RestFn.java:408) | |
at clojure.lang.Var.invoke(Var.java:379) | |
at clojure.lang.AFn.applyToHelper(AFn.java:154) | |
at clojure.lang.Var.applyTo(Var.java:700) | |
at clojure.main.main(main.java:37) | |
Caused by: java.lang.IllegalArgumentException: Must have a name! | |
at user$greet.invoke(hello.clj:3) | |
at user$eval2.invoke(hello.clj:6) | |
at clojure.lang.Compiler.eval(Compiler.java:6706) | |
at clojure.lang.Compiler.load(Compiler.java:7133) | |
... 9 more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment