This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-11
Channels
- # aleph (5)
- # beginners (13)
- # boot (2)
- # cljs-dev (1)
- # clojure (12)
- # clojure-italy (1)
- # clojure-russia (67)
- # clojure-uk (2)
- # clojurescript (49)
- # datomic (1)
- # defnpodcast (3)
- # graphql (8)
- # jobs (1)
- # lein-figwheel (1)
- # leiningen (1)
- # lumo (9)
- # off-topic (5)
- # om (3)
- # parinfer (13)
- # pedestal (2)
- # re-frame (5)
- # reagent (4)
- # ring-swagger (2)
- # untangled (13)
- # yada (2)
hi all! so in clojure this seems to work
user> (def op "+")
#'user/op
user> ((eval (symbol op)) 1 1)
2
calculator.core> (def op "+")
#'calculator.core/op
calculator.core> ((eval (symbol op)) 1 1)
WARNING: Use of undeclared Var calculator.core/eval at line 1 <cljs repl>
#object[TypeError TypeError: calculator.core.eval is undefined]
clojurescript isn't self hosting - at least the normal version isn't
if you use resolve, you can still look up the symbol without needing the compiler
never mind, resolve doesn't exist in cljs either anyway
Cheers @noisesmith
i'd like to define a lein task that seeds my database and it would run a function in a particular namespace. is this possible? all the aliases i've seen tend to run external commands and not functions within the application.
@joshkh Yes, you can use the lein run -m namespace/function
command.
:aliases {"foo" ["run" "-m" "foo.core/foo"]}
also if you define a -main you can run that from an uberjar without lein, with java -cp my-uber.jar clojure.main -m foo.core