Skip to content

Instantly share code, notes, and snippets.

@erasmas
Created Dec 18, 2015
Embed
What would you like to do?
(ns hello-world.core
(:require
[cljs.core.async :as async :refer [put! chan <! >! close!]]
[cljs.nodejs :as node])
(:require-macros
[cljs.core.async.macros :refer [go]]))
(enable-console-print!)
(node/enable-util-print!)
(def request (node/require "request"))
(defn GET [url]
(let [ch (chan 1)]
(request url
(fn [_ _ body]
(go (>! ch body)
(close! ch))))
ch))
Starting clojure.main REPL...
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java -Didea.launcher.port=7544 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Users/dmi3y/dev/projects/throwaway/hello-world/resources:/Users/dmi3y/dev/projects/throwaway/hello-world/dev-resources:/Users/dmi3y/dev/projects/throwaway/hello-world/src:/Users/dmi3y/dev/projects/throwaway/hello-world/test:/Users/dmi3y/dev/projects/throwaway/hello-world/target/classes:/Users/dmi3y/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar:/Users/dmi3y/.m2/repository/com/google/javascript/closure-compiler/v20151015/closure-compiler-v20151015.jar:/Users/dmi3y/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar:/Users/dmi3y/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170-aot.jar:/Users/dmi3y/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar:/Users/dmi3y/.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6-aot.jar:/Users/dmi3y/.m2/repository/org/clojure/google-closure-library-third-party/0.0-20151016-61277aea/google-closure-library-third-party-0.0-20151016-61277aea.jar:/Users/dmi3y/.m2/repository/org/clojure/google-closure-library/0.0-20151016-61277aea/google-closure-library-0.0-20151016-61277aea.jar:/Users/dmi3y/.m2/repository/org/clojure/tools.nrepl/0.2.10/tools.nrepl-0.2.10.jar:/Users/dmi3y/.m2/repository/org/clojure/tools.reader/0.10.0-alpha3/tools.reader-0.10.0-alpha3.jar:/Users/dmi3y/.m2/repository/org/mozilla/rhino/1.7R5/rhino-1.7R5.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain clojure.main scripts/node_repl.clj -r
Reading analysis cache for jar:file:/Users/dmi3y/.m2/repository/org/clojure/clojurescript/1.7.170/clojurescript-1.7.170-aot.jar!/cljs/core.cljs
Compiling src/hello_world/core.cljs
Exception in thread "main" clojure.lang.ExceptionInfo: failed compiling file:src/hello_world/core.cljs {:file #object[java.io.File 0x6f3e19b3 "src/hello_world/core.cljs"]}, compiling:(/Users/dmi3y/dev/projects/throwaway/hello-world/scripts/node_repl.clj:5:1)
at clojure.lang.Compiler.load(Compiler.java:7239)
at clojure.lang.Compiler.loadFile(Compiler.java:7165)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$script_opt.invoke(main.clj:337)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: clojure.lang.ExceptionInfo: failed compiling file:src/hello_world/core.cljs {:file #object[java.io.File 0x6f3e19b3 "src/hello_world/core.cljs"]}
at clojure.core$ex_info.invoke(core.clj:4593)
at cljs.compiler$compile_file$fn__2630.invoke(compiler.cljc:1343)
at cljs.compiler$compile_file.invoke(compiler.cljc:1310)
at cljs.closure$compile_file.invoke(closure.clj:434)
at cljs.closure$fn__3010.invoke(closure.clj:491)
at cljs.closure$fn__2955$G__2948__2962.invoke(closure.clj:391)
at cljs.closure$compile_sources$iter__3103__3107$fn__3108.invoke(closure.clj:755)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:674)
at clojure.core$next__4112.invoke(core.clj:64)
at clojure.core$dorun.invoke(core.clj:3010)
at clojure.core$doall.invoke(core.clj:3025)
at cljs.closure$compile_sources.invoke(closure.clj:751)
at cljs.closure$build.invoke(closure.clj:1807)
at cljs.build.api$build.invoke(api.clj:207)
at cljs.build.api$build.invoke(api.clj:201)
at user$eval7.invoke(node_repl.clj:5)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.load(Compiler.java:7227)
... 14 more
Caused by: clojure.lang.ExceptionInfo: No such namespace: cljs.core.async, could not locate cljs/core/async.cljs, cljs/core/async.cljc, or Closure namespace "cljs.core.async" {:tag :cljs/analysis-error}
at clojure.core$ex_info.invoke(core.clj:4593)
at cljs.analyzer$error.invoke(analyzer.cljc:568)
at cljs.analyzer$error.invoke(analyzer.cljc:566)
at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:1656)
at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:2492)
at cljs.analyzer$analyze_STAR_$fn__1957.invoke(analyzer.cljc:2573)
at clojure.lang.PersistentVector.reduce(PersistentVector.java:333)
at clojure.core$reduce.invoke(core.clj:6518)
at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:2573)
at cljs.analyzer$analyze.invoke(analyzer.cljc:2588)
at cljs.compiler$compile_file_STAR_$fn__2590.invoke(compiler.cljc:1221)
at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1149)
at cljs.compiler$compile_file_STAR_.invoke(compiler.cljc:1172)
at cljs.compiler$compile_file$fn__2630.invoke(compiler.cljc:1331)
... 33 more
Process finished with exit code 1
(require 'cljs.repl)
(require 'cljs.build.api)
(require 'cljs.repl.node)
(cljs.build.api/build "src"
{:main 'hello-world.core
:output-to "out/main.js"
:verbose true})
(cljs.repl/repl (cljs.repl.node/repl-env)
:watch "src"
:output-dir "out")
(defproject hello-world "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.189" :classifier "aot"
:exclusion [org.clojure/data.json]]
[org.clojure/core.async "0.2.371"]
[org.clojure/data.json "0.2.6" :classifier "aot"]]
:jvm-opts ^:replace ["-Xmx1g" "-server"]
:plugins [[lein-npm "0.6.1"]
[lein-cljsbuild "1.1.1"]]
:npm {:dependencies [[source-map-support "0.3.2"]
[request "2.67.0"]]}
:source-paths ["src" "target/classes"]
:clean-targets ["out" "release"]
:target-path "target"
:target :nodejs
:cljsbuild {:builds
{:dev {:source-paths ["src"]}
:compiler {:output-to "out/main.js"
:optimizations :simple}}}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment