I wrote some tests, I found that:
Only namespaces which is a dependency of my compiled clojurescript can be required in repl.
Namespaces which not refered by any compiled clojurescript can NOT be required in repl.
Is this the limitation of REPL? Or something wrong here?
When I require namespaces which not refered by any compiled clojurescript, I got error:
cljs.user> (require 'cljsjs.d3)
711cljs.core._STAR_print_namespace_maps_STAR_ = true
712Loading: (goog)
713Loading: (cljsjs.d3)
714goog.addDependency("base.js", [], []);
715goog.addDependency("../cljsjs/d3/development/d3.inc.js", [], []);
716
717goog.require('cljsjs.d3');
718null;
719
720"Error evaluating:" (require (quote cljsjs.d3)) :as "goog.require('cljsjs.d3');\nnull;\n"
721Error: goog.require could not find: cljsjs.d3
722Failed to canonicalize stacktrace
723clojure.lang.ExceptionInfo: Could not relativize URL http://192.168.124.5:9000/goog/base.js {:type :parse-stacktrace, :reason :relativize-url}
724 at clojure.core$ex_info.invokeStatic(core.clj:4617)
725 at clojure.core$ex_info.invoke(core.clj:4617)
726 at cljs.stacktrace$parse_file.invokeStatic(stacktrace.cljc:104)
727 at cljs.stacktrace$parse_file.invoke(stacktrace.cljc:81)
728 at cljs.stacktrace$chrome_st_el__GT_frame.invokeStatic(stacktrace.cljc:121)
729 at cljs.stacktrace$chrome_st_el__GT_frame.invoke(stacktrace.cljc:111)
730 at cljs.stacktrace$eval9220$fn__9221$fn__9222.invoke(stacktrace.cljc:142)
731 at clojure.core$map$fn__4785.invoke(core.clj:2646)
732 at clojure.lang.LazySeq.sval(LazySeq.java:40)
733 at clojure.lang.LazySeq.seq(LazySeq.java:49)
734 at clojure.lang.RT.seq(RT.java:521)
735 at clojure.core$seq__4357.invokeStatic(core.clj:137)
736 at clojure.core$filter$fn__4812.invoke(core.clj:2700)
737 at clojure.lang.LazySeq.sval(LazySeq.java:40)
738 at clojure.lang.LazySeq.seq(LazySeq.java:49)
739 at clojure.lang.RT.seq(RT.java:521)
740 at clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:44)
741 at clojure.core$vec.invokeStatic(core.clj:377)
742 at clojure.core$vec.invoke(core.clj:367)
743 at cljs.stacktrace$eval9220$fn__9221.invoke(stacktrace.cljc:138)
744 at clojure.lang.MultiFn.invoke(MultiFn.java:243)
745 at cljs.repl.browser.BrowserEnv._parse_stacktrace(browser.clj:281)
746 at cemerick.piggieback$fn__9491.invokeStatic(piggieback.clj:100)
747 at cemerick.piggieback$fn__9491.invoke(piggieback.clj:99)
748 at cljs.repl$eval8750$fn__8751$G__8741__8762.invoke(repl.cljc:147)
749 at cljs.repl$display_error$fn__8901.invoke(repl.cljc:440)
750 at cljs.repl$display_error.invokeStatic(repl.cljc:439)
751 at cljs.repl$display_error.invoke(repl.cljc:428)
752 at cljs.repl$repl_caught.invokeStatic(repl.cljc:753)
753 at cljs.repl$repl_caught.invoke(repl.cljc:744)
754 at cemerick.piggieback$run_cljs_repl$fn__9524.invoke(piggieback.clj:206)
755 at cljs.repl$repl_STAR_$fn__9046$fn__9055.invoke(repl.cljc:927)
756 at cljs.repl$repl_STAR_$fn__9046.invoke(repl.cljc:924)
757 at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1271)
758 at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1260)
759 at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:888)
760 at cljs.repl$repl_STAR_.invoke(repl.cljc:760)
761 at cemerick.piggieback$run_cljs_repl.invokeStatic(piggieback.clj:169)
762 at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:155)
763 at clojure.lang.AFn.applyToHelper(AFn.java:171)
764 at clojure.lang.AFn.applyTo(AFn.java:144)
765 at clojure.core$apply.invokeStatic(core.clj:650)
766 at clojure.core$apply.invoke(core.clj:641)
767 at cemerick.piggieback$evaluate.invokeStatic(piggieback.clj:259)
768 at cemerick.piggieback$evaluate.invoke(piggieback.clj:255)
769 at clojure.lang.Var.invoke(Var.java:379)
770 at cemerick.piggieback$wrap_cljs_repl$fn__9548$fn__9550$fn__9551.invoke(piggieback.clj:291)
771 at cemerick.piggieback$enqueue$fn__9534.invoke(piggieback.clj:247)
772 at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__994.invoke(interruptible_eval.clj:190)
773 at clojure.lang.AFn.run(AFn.java:22)
774 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
775 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
776 at java.lang.Thread.run(Thread.java:748)
777
778Error: goog.require could not find: cljsjs.d3
779 at Object.goog.require [as require__] (http://192.168.124.5:9000/goog/base.js:711:15)
780 at Object.clojure.browser.repl.bootstrap.goog.require (http://192.168.124.5:9000/clojure/browser/repl.js:295:16)
781 at eval (eval at <anonymous> (http://192.168.124.5:9000/clojure/browser/repl.js:106:297), <anonymous>:1:6)
782 at http://192.168.124.5:9000/clojure/browser/repl.js:106:297
783 at clojure$browser$repl$evaluate_javascript (http://192.168.124.5:9000/clojure/browser/repl.js:109:4)
784 at Object.callback (http://192.168.124.5:9000/clojure/browser/repl.js:316:169)
785 at goog.net.xpc.CrossPageChannel.goog.messaging.AbstractChannel.deliver (http://192.168.124.5:9000/goog/messaging/abstractchannel.js:141:13)
786 at goog.net.xpc.CrossPageChannel.xpcDeliver (http://192.168.124.5:9000/goog/net/xpc/crosspagechannel.js:734:12)
787 at Function.goog.net.xpc.NativeMessagingTransport.messageReceived_ (http://192.168.124.5:9000/goog/net/xpc/nativemessagingtransport.js:321:13)
788 at Object.goog.events.fireListener (http://192.168.124.5:9000/goog/events/events.js:744:21)
789cljs.user> (require 'cljsjs.d3)
===========================================
1. Unhandled clojure.lang.ExceptionInfo
6 Error: goog.require could not find: cljsjs.d3
7 {:type :js-eval-exception,
8 :error
9 {:status :exception,
10 :ua-product :chrome,
11 :value "Error: goog.require could not find: cljsjs.d3",
12 :stacktrace
13 "Error: goog.require could not find: cljsjs.d3\n at Object.goog.require [as require__] (http://192.168.124.5:9000/goog/base.js:711:15)\n at Object.clojure.browser.repl.bootstrap.$
14 :form (require 'cljsjs.d3),
15 :js "goog.require('cljsjs.d3');\nnull;\n"}
16
17 core.clj: 4617 clojure.core/ex-info
18 repl.cljc: 527 cljs.repl$evaluate_form/invokeStatic
20 repl.cljc: 452 cljs.repl$evaluate_form/invoke
21 repl.cljc: 625 cljs.repl$eval_cljs/invokeStatic
22 repl.cljc: 618 cljs.repl$eval_cljs/invoke
23 repl.cljc: 880 cljs.repl$repl_STAR_$read_eval_print__9038/invoke
24 repl.cljc: 925 cljs.repl$repl_STAR_$fn__9046$fn__9055/invoke
25 repl.cljc: 924 cljs.repl$repl_STAR_$fn__9046/invoke
26 compiler.cljc: 1271 cljs.compiler$with_core_cljs/invokeStatic
27 compiler.cljc: 1260 cljs.compiler$with_core_cljs/invoke
28 repl.cljc: 888 cljs.repl$repl_STAR_/invokeStatic
29 repl.cljc: 760 cljs.repl$repl_STAR_/invoke
30 piggieback.clj: 169 cemerick.piggieback/run-cljs-repl
31 piggieback.clj: 155 cemerick.piggieback/run-cljs-repl
32 AFn.java: 171 clojure.lang.AFn/applyToHelper
33 AFn.java: 144 clojure.lang.AFn/applyTo
34 core.clj: 650 clojure.core/apply
35 core.clj: 641 clojure.core/apply
36 piggieback.clj: 259 cemerick.piggieback/evaluate
37 piggieback.clj: 255 cemerick.piggieback/evaluate
38 Var.java: 379 clojure.lang.Var/invoke
39 piggieback.clj: 291 cemerick.piggieback/wrap-cljs-repl/fn/fn/fn
40 piggieback.clj: 247 cemerick.piggieback/enqueue/fn
41 AFn.java: 22 clojure.lang.AFn/run
43 ThreadPoolExecutor.java: 1149 java.util.concurrent.ThreadPoolExecutor/runWorker
44 ThreadPoolExecutor.java: 624 java.util.concurrent.ThreadPoolExecutor$Worker/run
45 Thread.java: 748 java.lang.Thread/run
project.clj:
(defproject apps "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories [#_["my.datomic.com" {:url "https://my.datomic.com/repo"
:snapshots false
:username "xfcjscn#gmail.com"
:password "18f81b06-0226-4d59-9060-7e01182a6030"}]]
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/core.async "0.3.443"]
[org.clojure/tools.logging "0.4.0"]
[org.clojure/tools.reader "1.1.0"]
[org.clojure/clojurescript "1.9.946"]
[org.clojure/math.numeric-tower "0.0.4"]
;; apps.nrepl-cider
[cider/cider-nrepl "0.15.1"]
;; seems weasel is optional, I can integrate cider with piggieback to support browser support. It's bad to introduce weasel api into my cljs file
[com.cemerick/piggieback "0.2.2"]
;; cms
[ring "1.6.3"]
[ring/ring-defaults "0.3.1"]
[ring-webjars "0.2.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
[compojure "1.6.0"]
[hiccup "1.0.5"]
;; my licence expire on 2017/05/17, upgrade not supported, so only 0.9.5561 supported. can register new account?
;; this is free but not for open source
;;[com.datomic/datomic-pro "0.9.5561" :exclusions [commons-codec org.apache.httpcomponents/httpclient org.slf4j/slf4j-nop]]
[com.datomic/datomic-free "0.9.5561.62" :exclusions [commons-codec org.apache.httpcomponents/httpclient org.slf4j/slf4j-nop com.google.guava/guava]]
[org.webjars.bower/tether "1.4.0"]
[org.webjars/bootstrap "4.0.0-beta.2"]
[org.webjars.bower/semantic "2.2.13"]
[endophile "0.2.1"]
[buddy/buddy-auth "2.1.0"]
[oauth-clj "0.1.15" :exclusions [commons-logging]]
[org.danielsz/system "0.4.0"]
[com.cemerick/pomegranate "1.0.0" :exclusions [commons-logging]]
[prone "1.1.4"]
[ring-logger "0.7.7"]
;; logging
[org.slf4j/jcl-over-slf4j "1.7.25"]
[ch.qos.logback/logback-classic "1.2.3"]
;; for tools
[enlive "1.1.6"]
[com.draines/postal "2.0.2"]
;; for incanter-example
[net.mikera/core.matrix "0.61.0"]
[incanter "1.9.0"]
;; for ml week 4
[net.mikera/imagez "0.12.0"]
[quil "2.6.0"]
;; mvn install:install-file -DgroupId=apps -DartifactId=extruder -Dversion=1.02 -Dpackaging=jar -Dfile=extruder.jar -DgeneratePom=true -DcreateChecksum=true
[apps/extruder "1.02"]
[apps/peasycam "202"]
[apps/shapes3d "2.2"]
;; func-plot
[prismatic/dommy "1.1.0"]
[hipo "0.5.2"]
[cljsjs/three "0.0.87-0"]
;; sources
[org.processing/core "3.3.6" :classifier "sources"]
]
;;:jvm-opts ["-Xmx6g" "-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"]
;; cider don't inject this automaticlly, so duplicate with code in nrepl-cider
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:plugins [[lein-ancient "0.6.14"]]
)
REPL startup script:
(ns apps.cljs-rt-browser
(:require [clojure.tools.logging :as log]
[clojure.java.io :as io]
[hiccup.core :refer [html]]
[hiccup.page :refer [include-js]]
[hiccup.element :refer [javascript-tag]]
cljs.build.api
cljs.repl.browser
cemerick.piggieback
))
(def repl-client-url "http://192.168.124.5:9000/repl")
(def index-hcp
[:html
[:head]
[:body
(include-js "goog/base.js" "main.js")
(javascript-tag (cljs.build.api/compile {} '(require 'clojure.browser.repl)))
(javascript-tag (cljs.build.api/compile {} (apply list `(clojure.browser.repl/connect ~repl-client-url))))]])
(def index-path "out/index.html")
(defn -main []
;; generate:
;; module system: goog/base.js, module info of google: goog/deps.js, module of google: goog/**
;; module info of other: main.js, module of others
(cljs.build.api/build "src" {:output-to "out/main.js"
:browser-repl true
:verbose true
})
;; repl will serve static, so just generate index.html
(when-not (. (io/file index-path) exists)
(spit index-path (html index-hcp)))
;; exclude "." from static-dir to avoid overwrite of repl compiled files: out/out/**
(cemerick.piggieback/cljs-repl (cljs.repl.browser/repl-env :static-dir ["out/"]) :repl-verbose true))
(-main)
Related
I'm trying to run boot repl and I get the following error.
java.lang.Thread.run Thread.java: 832
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 630
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1130
java.util.concurrent.FutureTask.run FutureTask.java: 264
...
clojure.core/binding-conveyor-fn/fn core.clj: 1938
Skipped a lot of lines here
java.lang.ClassLoader.loadClass ClassLoader.java: 589
...
java.net.URLClassLoader.findClass URLClassLoader.java: 435
java.lang.ClassNotFoundException: sun.misc.Launcher
clojure.lang.ExceptionInfo: sun.misc.Launcher
I was following a guide on how to set up boot from spacemacs. The information there was outdated or wrong. The problem was that in my ~/.boot/profile.boot To solve the issue I had to change dependencies from what was on spacemacs site to what was on refactor-nrepl.
(require 'boot.repl)
(swap! boot.repl/*default-dependencies* conj
'[refactor-nrepl "2.5.1"]
'[cider/cider-nrepl "0.25.9"])
(swap! boot.repl/*default-middleware* conj
'refactor-nrepl.middleware/wrap-refactor)
Likely something wrong with my updated build.boot file: https://github.com/laforge49/sente-boot/blob/master/build.boot
(Been on the backend too long!)
I've tried changing the version of clojure and clojurescript. Previously I was not finding class RT, so I've made some progress at least.
Here's my dependencies:
:dependencies '[
[org.clojure/clojure "1.9.0" :scope "provided"]
[org.clojure/core.async "0.4.490"]
[org.clojure/clojurescript "1.9.562"]
[adzerk/boot-reload "0.5.1" :scope "test"]
[adzerk/boot-cljs "2.0.0" :scope "test"]
[com.taoensso/sente "1.14.0-RC2"] ; <--- Sente
[com.taoensso/timbre "4.10.0"]
[http-kit "2.3.0"]
[ring "1.7.1"]
[ring/ring-defaults "0.3.2"] ; Includes `ring-anti-forgery`, etc.
[compojure "1.6.1"] ; Or routing lib of your choice
[hiccup "1.0.5"] ; Optional, just for HTML
[com.cognitect/transit-clj "0.8.313"]
[com.cognitect/transit-cljs "0.8.256"]
[onetom/boot-lein-generate "0.1.3"]]
I get this error:
clojure.lang.ExceptionInfo: clojure/lang/IFn
data: {:file "org\\httpkit\\server.clj", :line 66}
java.lang.NoClassDefFoundError: clojure/lang/IFn
java.lang.ClassNotFoundException: clojure.lang.IFn
...
clojure.core/load/fn core.clj: 6007
clojure.core/load/invokeStatic core.clj: 6006
clojure.core/load core.clj: 5990
...
Lein is not running my main method. I've even introduced syntax errors, and it doesn't catch them. I'm really stumped. I'd greatly appreciate any assistance from the community.
I believe the main method is specified correctly. The first code sample is server.clj, with the main method. Next is my project.clj.
(ns naac.server
(:require [naac.handler :refer [handler]]
[config.core :refer [env]]
[migratus.core :as migratus]
[ring.adapter.jetty :refer [run-jetty]]
[naac.db :refer [load-db!]])
(:gen-class))
(def db-config {:store :database
:db (get (System/getenv) "DATABASE_URL"
"jdbc:postgresql://localhost:5432/jeff")
:migration-dir "migrations"})
(defn -main [& args]
(println args)
(doseq [a args]
(cond
(= a "migrate")
(do
(println "Migrate database...")
(migratus/migrate db-config)
(println "...Migration done."))
(= a "rollback")
(do
(println "Rollback database...")
(migratus/rollback db-config)
(println "...Rollback done."))
(= a "load")
(do
(println "Load database...")
(load-db!)
(println "...Load done."))))
(if (> (count args) 0) (System/exit 0))
(let [port (Integer/parseInt (or (env :port) "3000"))]
(run-jetty handler {:port port :join? false})))
My project.clj:
(defproject naac "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.229"]
[reagent "0.6.0"]
[re-frame "0.9.2"]
[compojure "1.5.0"]
[yogthos/config "0.8"]
[migratus "0.9.2"]
[ring "1.4.0"]
[com.layerware/hugsql "0.4.7"]
[org.postgresql/postgresql "9.4.1207"]]
:plugins [[lein-cljsbuild "1.1.4"]
[migratus-lein "0.4.1"]]
:min-lein-version "2.5.3"
:source-paths ["src"]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:figwheel {:css-dirs ["resources/public/css"]
:ring-handler naac.handler/dev-handler}
:profiles
{:dev {:dependencies [[binaryage/devtools "0.8.2"]]
:plugins [[lein-figwheel "0.5.9"]]
:resource-paths ["resources/config"]}
}
:migratus {:store :database
:db ~(get (System/getenv) "DATABASE_URL"
"jdbc:postgresql://localhost:5432/jeff")
:migration-dir "migrations"}
:cljsbuild
{:builds
[{:id "dev"
:source-paths ["src/cljs"]
:figwheel {:on-jsload "naac.core/mount-root"}
:compiler {:main naac.core
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:asset-path "js/compiled/out"
:source-map-timestamp true
:preloads [devtools.preload]
:external-config {:devtools/config {:features-to-install :all}}
}}
{:id "min"
:source-paths ["src/cljs"]
:jar true
:compiler {:main naac.core
:output-to "resources/public/js/compiled/app.js"
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false}}
]}
:main naac.server
:aot [naac.server]
:uberjar-name "naac.jar"
:prep-tasks [["cljsbuild" "once" "min"] "compile"]
)
MY directory structure can be seen in this image. IF you need a deeper nesting level you can see it here.
When I run lein I get this output:
Compiling ClojureScript...
2017-05-09 12:12:12.739:INFO::main: Logging initialized #2438ms
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
INFO: Starting migrations
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
WARNING: skipping: '.DS_Store' migrations must match pattern: ^(\d+)-([^\.]+)((?:\.[^\.]+)+)$
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
INFO: Ending migrations
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
INFO: Starting migrations
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
WARNING: skipping: '.DS_Store' migrations must match pattern: ^(\d+)-([^\.]+)((?:\.[^\.]+)+)$
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
INFO: Ending migrations
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
INFO: Starting migrations
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
WARNING: skipping: '.DS_Store' migrations must match pattern: ^(\d+)-([^\.]+)((?:\.[^\.]+)+)$
May 09, 2017 12:12:12 PM clojure.tools.logging$eval18$fn__22 invoke
INFO: Ending migrations
The problem is :source-paths in your project.clj. Lein expects your namespace folder to be directly in the source path.
You can either move your naac folder directly into src (e.g. src/naac/server.clj) or use ["src/clj"] as the value for :source-paths
The project file:
(defproject testclojure "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.typed "0.2.84"]
[alembic "0.3.2"]]
:main ^:skip-aot testclojure.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
The code:
(ns testclojure.core
(:gen-class)
(:require [clojure.core.typed :refer [ann AnyInteger check-ns]])
(:import [clojure.lang ISeq]))
(ann ^:no-check clojure.core/mod [AnyInteger AnyInteger -> AnyInteger])
(ann div-by [AnyInteger AnyInteger -> Boolean])
(defn div-by [x y]
(== (mod y x) 0))
(ann div-by-3-or-5 [AnyInteger -> Boolean])
(defn div-by-3-or-5 [x]
(or (div-by 3 x) (div-by 5 x)))
(ann euler1 [AnyInteger -> AnyInteger])
(defn euler1 [n]
(reduce + (filter div-by-3-or-5 (range n))))
(ann -main [-> nil] )
(defn -main []
(prn (euler1 "a")))
lein compile gives no error at all.
As the docstring for check-ns says:
Do not use check-ns within a checked namespace.
It is intended to be used at the REPL or within a unit test.
Suggested idiom for clojure.test: (is (check-ns 'your.ns))
If you put this in test/testclojure/core_test.clj:
(ns testclojure.core-test
(:require [clojure.test :refer :all]
[clojure.core.typed :refer [check-ns]]
testclojure.core))
(deftest core-typed
(is (check-ns 'testclojure.core)))
lein test will rightly complain about the type problem:
lein test testclojure.core-test
Initializing core.typed ...
Building core.typed base environments ...
Finished building base environments
"Elapsed time: 4251.270066 msecs"
core.typed initialized.
Start collecting testclojure.core
WARNING: Duplicate var annotation: clojure.core/mod
Finished collecting testclojure.core
Collected 1 namespaces in 833.458074 msecs
Not checking clojure.core.typed (does not depend on clojure.core.typed)
Start checking testclojure.core
Checked testclojure.core in 992.400431 msecs
Checked 2 namespaces in 1843.974821 msecs
Type Error (testclojure/core.clj:22:8) Function euler1 could not be applied to arguments:
Domains:
AnyInteger
Arguments:
(clojure.core.typed/Val "a")
Ranges:
AnyInteger
in: (euler1 "a")
in: (euler1 a)
lein test :only testclojure.core-test/core-typed
ERROR in (core-typed) (core.clj:4403)
expected: (check-ns (quote testclojure.core))
actual: clojure.lang.ExceptionInfo: Type Checker: Found 1 error
at clojure.core$ex_info.invoke (core.clj:4403)
clojure.core.typed.errors$print_errors_BANG_.invoke (errors.clj:234)
clojure.core.typed.check_ns_common$check_ns$fn__24049.invoke (check_ns_common.clj:114)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1862)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.core.typed.check_ns_common$check_ns.doInvoke (check_ns_common.clj:112)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:628)
clojure.core.typed.check_ns_clj$check_ns.doInvoke (check_ns_clj.clj:23)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:626)
clojure.core.typed$check_ns.doInvoke (typed.clj:2241)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:624)
testclojure.core_test/fn (core_test.clj:7)
clojure.test$test_var$fn__7187.invoke (test.clj:704)
clojure.test$test_var.invoke (test.clj:704)
clojure.test$test_vars$fn__7209$fn__7214.invoke (test.clj:722)
clojure.test$default_fixture.invoke (test.clj:674)
clojure.test$test_vars$fn__7209.invoke (test.clj:722)
clojure.test$default_fixture.invoke (test.clj:674)
clojure.test$test_vars.invoke (test.clj:718)
clojure.test$test_all_vars.invoke (test.clj:728)
clojure.test$test_ns.invoke (test.clj:747)
clojure.core$map$fn__4245.invoke (core.clj:2559)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.boundedLength (RT.java:1654)
clojure.lang.RestFn.applyTo (RestFn.java:130)
clojure.core$apply.invoke (core.clj:626)
clojure.test$run_tests.doInvoke (test.clj:762)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:624)
user$eval85$fn__140$fn__171.invoke (form-init5812871912759411988.clj:1)
user$eval85$fn__140$fn__141.invoke (form-init5812871912759411988.clj:1)
user$eval85$fn__140.invoke (form-init5812871912759411988.clj:1)
user$eval85.invoke (form-init5812871912759411988.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6703)
clojure.lang.Compiler.eval (Compiler.java:6693)
clojure.lang.Compiler.load (Compiler.java:7130)
clojure.lang.Compiler.loadFile (Compiler.java:7086)
clojure.main$load_script.invoke (main.clj:274)
clojure.main$init_opt.invoke (main.clj:279)
clojure.main$initialize.invoke (main.clj:307)
clojure.main$null_opt.invoke (main.clj:342)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
Ran 1 tests containing 1 assertions.
0 failures, 1 errors.
Tests failed.
When I try to use
(ns eight-puzzle.core
(:use [clojure.contrib.seq :only (positions)]))
I get this error
java.io.FileNotFoundException: Could not locate clojure/contrib/seq__init.class or clojure/contrib/seq.clj on classpath:
RT.java:443 clojure.lang.RT.load
RT.java:411 clojure.lang.RT.load
core.clj:5530 clojure.core/load[fn]
core.clj:5529 clojure.core/load
RestFn.java:408 clojure.lang.RestFn.invoke
core.clj:5336 clojure.core/load-one
core.clj:5375 clojure.core/load-lib[fn]
core.clj:5374 clojure.core/load-lib
RestFn.java:142 clojure.lang.RestFn.applyTo
core.clj:619 clojure.core/apply
core.clj:5413 clojure.core/load-libs
RestFn.java:137 clojure.lang.RestFn.applyTo
core.clj:621 clojure.core/apply
core.clj:5507 clojure.core/use
RestFn.java:408 clojure.lang.RestFn.invoke
NO_SOURCE_FILE:1 eight-puzzle.core/eval8699[fn]
NO_SOURCE_FILE:1 eight-puzzle.core/eval8699
And this problem happens when ever I try to import anything in. Did I do something wrong when setting up clojure?
External dependencies, for projects managed by Leiningen, should be specified in the project.clj file, under the :dependencies key.
(defproject project1 "0.0.1"
:description "Something"
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojure-contrib "1.2.0"]
[clj-time "0.6.0"]])
Note: The entries in :dependencies can originate from either maven (maven central repository) or Clojars.
It also looks like you are using clojure.contrib. This library has been deprecated and you should upgrade, if you can. If you are only using clojure.contrib.seq/positions, take a look at this StackOverflow answer. You can also reimplement it with just clojure.core functions:
(defn positions [pred coll]
(for [[idx elt]
(map-indexed vector coll)
:when (pred elt)]
idx))