Clojure failing to compile jackknife - clojure

As a clojure noob, I am trying to use cascalog to parse a large CSV file. Here is my minimal project.clj:
(defproject org.example/sample "1.0.0-SNAPSHOT"
:description "extract fields from a certain csv file."
:dependencies [
[cascalog "2.0.0"]
[clojure-csv/clojure-csv "2.0.1"]
]
:profiles { :dev {:dependencies [[org.apache.hadoop/hadoop-core "1.1.2"]]}}
:jvm-opts ["-Xms768m" "-Xmx768m"]
)
lein deps succeeds, but when I run (use 'cascalog.api) inside lein repl, then I get the following error:
CompilerException java.lang.RuntimeException: Unable to resolve symbol: combinations in this context, compiling:(jackknife/seq.clj:12)
Removing clojure-csv from project.clj prevents the error, but I can run (use 'clojure-csv.core) inside lein repl without error.
One other person on the internet appears to have had this problem, but has not posted a solution. What is going on here, and how should I fix it? I'd be eternally grateful if someone could help.

Related

clojure ubergraph compiling error - 'namespace 'ubergraph.core' not found

I have been using ubergraph last few weeks up until this morning, but now am having compiling problem.
In my project.clj's dependencies, ubergraph is declared:
(defproject graph-alg "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.0"]
[ubergraph "0.8.2"]]
In my core.clj, I have
(ns gaph-alg.core
(:require [ubergraph.core :as uber]))
Even with these settings, when compiling in emacs, I kept having this error message:
*Error compiling c:/.Clojure/snippets/graphworks/graph-alg/src/graph_alg/core.clj at
(1:1)
#:clojure.error{:phase :compile-syntax-check,
:line 1,
:column 1,
:source
"c:/.Clojure/snippets/graphworks/graph-alg/src/graph_alg/core.clj"}
Caused by java.lang.Exception namespace 'ubergraph.core' not found*
I recreated new projects using lein few times with above setting, but still have same issue like above.
I am not sure whether this comes from emacs cider-repl or something else.
Does anybody else know how to handle this problem?
Thanks in advance.

Getting started with datomic and clojure - Could not locate datomic/api__init.class on classpath

I am trying to run datomic's in-memory database with this tutorial https://clojureverse.org/t/a-quick-way-to-start-experimenting-with-datomic/5004 with the free version. I downloaded the .zip file and put it in program files. Then I created a project with leiningen and I did the other steps indicated in the tutorial, but when I want to evaluate the lines with the repl for creating the database and connection it throws:
"Error:
Syntax error compiling at (c:\Users\usuario\Desktop\clojure\datomic-shortcut\src\datomic_shortcut\core.clj:7:3).
No such namespace: d"
... and when I evaluate the entire file, the following:
Evaluating file: core.clj
Syntax error (FileNotFoundException) compiling at (c:\Users\usuario\Desktop\clojure\datomic-shortcut\src\datomic_shortcut\core.clj:1:1).
Could not locate datomic/api__init.class, datomic/api.clj or datomic/api.cljc on classpath.
Evaluation of file core.clj failed: class clojure.lang.Compiler$CompilerException
When checking the .m2 folder there is no datomic's dependency, even after trying 'lein deps'
I think it can be solved with lein pom/jar/install sequence but I dont find where or I dont know how to download the .jar file.
Any help or information is welcome.. thanks!
-------------EDIT--------------------
Im sorry, the .m2 folder contains the ...m2\repository\com\datomic\datomic-free\0.9.5697\datomic-free-0.9.5697.jar file indeed.
No errors with 'lein deps'
My project.clj:
(defproject datomic-shortcut "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.1"]
[com.datomic/datomic-free "0.9.5697"]]
:source-paths ["src"]
:repl-options {:init-ns datomic-shortcut.core})
My core.clj:
(ns datomic-shortcut.core
(:require [datomic.api :as d]))
(def db-uri "datomic:mem://foo")
(comment
(d/create-database db-uri)
(def conn (d/connect db-uri)))
I realized the classpath hasn't the .jar file in it.
C:\Users\usuario\Desktop\clojure\datomic-shortcut>lein classpath
=>
C:\Users\usuario\Desktop\clojure\datomic-shortcut\test;
C:\Users\usuario\Desktop\clojure\datomic-shortcut\src;
C:\Users\usuario\Desktop\clojure\datomic-shortcut\dev-resources;
C:\Users\usuario\Desktop\clojure\datomic-shortcut\resources;
C:\Users\usuario\Desktop\clojure\datomic-shortcut\target\classes;
C:\Users\usuario\.m2\repository\com\datomic\datomic-lucene-core\3.3.0\datomic-lucene-core-3.3.0.jar;
C:\Users\usuario\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;
C:\Users\usuario\.m2\repository\com\h2database\h2\1.3.171\h2-1.3.171.jar;
C:\Users\usuario\.m2\repository\org\apache\activemq\artemis-commons\1.4.0\artemis-commons-1.4.0.jar;
C:\Users\usuario\.m2\repository\nrepl\nrepl\0.6.0\nrepl-0.6.0.jar;
C:\Users\usuario\.m2\repository\org\apache\tomcat\tomcat-juli\7.0.27\tomcat-juli-7.0.27.jar;
C:\Users\usuario\.m2\repository\clojure-complete\clojure-complete\0.2.5\clojure-complete-0.2.5.jar;
C:\Users\usuario\.m2\repository\org\slf4j\jul-to-slf4j\1.7.7\jul-to-slf4j-1.7.7.jar;
C:\Users\usuario\.m2\repository\leinjacker\leinjacker\0.4.1\leinjacker-0.4.1.jar;
C:\Users\usuario\.m2\repository\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;
C:\Users\usuario\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.7\jcl-over-slf4j-1.7.7.jar;
C:\Users\usuario\.m2\repository\org\clojure\core.contracts\0.0.1\core.contracts-0.0.1.jar;
C:\Users\usuario\.m2\repository\org\codehaus\janino\commons-compiler\2.6.1\commons-compiler-2.6.1.jar;
C:\Users\usuario\.m2\repository\com\datomic\datomic-free\0.9.5697\datomic-free-0.9.5697.jar;
C:\Users\usuario\.m2\repository\org\clojure\core.unify\0.5.3\core.unify-0.5.3.jar;
C:\Users\usuario\.m2\repository\org\apache\johnzon\johnzon-core\0.9.4\johnzon-core-0.9.4.jar;
C:\Users\usuario\.m2\repository\commons-beanutils\commons-beanutils\1.9.2\commons-beanutils-1.9.2.jar;
C:\Users\usuario\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.7\log4j-over-slf4j-1.7.7.jar;
C:\Users\usuario\.m2\repository\useful\useful\0.8.5-alpha2\useful-0.8.5-alpha2.jar;
C:\Users\usuario\.m2\repository\org\slf4j\slf4j-nop\1.7.7\slf4j-nop-1.7.7.jar;
C:\Users\usuario\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;
C:\Users\usuario\.m2\repository\org\clojure\tools.cli\0.3.5\tools.cli-0.3.5.jar;
C:\Users\usuario\.m2\repository\lein-datomic\lein-datomic\0.2.0\lein-datomic-0.2.0.jar;
C:\Users\usuario\.m2\repository\org\fressian\fressian\0.6.5\fressian-0.6.5.jar;
C:\Users\usuario\.m2\repository\org\apache\geronimo\specs\geronimo-json_1.0_spec\1.0-alpha-1\geronimo-json_1.0_spec-1.0-alpha-1.jar;
C:\Users\usuario\.m2\repository\me\raynes\conch\0.4.0\conch-0.4.0.jar;
C:\Users\usuario\.m2\repository\org\apache\activemq\artemis-core-client\1.4.0\artemis-core-client-1.4.0.jar;
C:\Users\usuario\.m2\repository\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;
C:\Users\usuario\.m2\repository\org\clojure\clojure\1.10.1\clojure-1.10.1.jar;
C:\Users\usuario\.m2\repository\io\netty\netty-all\4.0.39.Final\netty-all-4.0.39.Final.jar;
C:\Users\usuario\.m2\repository\org\clojure\core.specs.alpha\0.2.44\core.specs.alpha-0.2.44.jar;
C:\Users\usuario\.m2\repository\org\codehaus\janino\commons-compiler-jdk\2.6.1\commons-compiler-jdk-2.6.1.jar;
C:\Users\usuario\.m2\repository\org\clojure\tools.macro\0.1.1\tools.macro-0.1.1.jar;
C:\Users\usuario\.m2\repository\org\apache\tomcat\tomcat-jdbc\7.0.27\tomcat-jdbc-7.0.27.jar;
C:\Users\usuario\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;
C:\Users\usuario\.m2\repository\org\clojure\spec.alpha\0.2.176\spec.alpha-0.2.176.jar
So then I tried:
C:\Users\usuario\Desktop\clojure\datomic-shortcut>java -cp C:/Users/usuario/.m2/repository/com/datomic/datomic-free/0.9.5697/datomic-free-0.9.5697.jar clojure.main
Error: no se ha encontrado o cargado la clase principal clojure.main

lein ring server: "That's not a task"

I'm trying to build the hello-world example for compojure and it's failing to start the ring task.
$ lein version
Leiningen 1.7.1 on Java 1.7.0_65 OpenJDK 64-Bit Server VM
$ lein new compojure test
Created new project in: /home/myaccount/test
Look over project.clj and start coding in compojure/core.clj
$ cd test/
$ lein ring server
That's not a task. Use "lein help" to list all tasks.
I've also tried using the hello-world on the luminous site, which also says it can't find that task or other examples, where lein complains that I'm using the wrong number of arguments even if I pull the line straight from their tutorial.
$ lein new luminus guestbook +h2
Wrong number of arguments to new task.
Expected ([project-name] [project-name project-dir])
I quess you are missing the ring and compjure plugins in the project.clj file:
(defproject compojure "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:plugins [[lein-ring "0.8.8"]
[compojure "1.1.6"]]
;; once you have the above, you'll see that you need
;; to configure ring. This is the most simple example:
:ring {:handler compojure.core/handler})
Of course you have to define a handler function in src/compojure/core.clj! See here or here for a very nice introduction.

Dependencies in a clojurescript with leiningen

I am seriously pulling my hair right now! I am a total noob at clojure: I can't seem to be able to get a simple clojurescript compilation done without this error:
ERROR: JSC_MISSING_PROVIDE_ERROR. required "clojure.core.async" namespace never provided at /home/jldupont/workspace/$someproject/target/cljsbuild-compiler-0/domain2/main.js line 4 : 0
I've got the following project.clj file:
(defproject $someproject "0.1"
:description "some project..."
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2030"]
[org.clojure/core.async "0.1.267.0-0d7780-alpha"]
]
:plugins [[lein-cljsbuild "0.3.2"]]
:cljsbuild {
:builds [{:id "domain2"
:source-paths ["src/cljs/model2/domain"]
:compiler {:output-to "src/assets/js/model2/domain/domain2.js"
:optimizations :advanced
:pretty-print true}
}
]
}
)
Everytime I use lein cljsbuild auto I get the error quoted above.
Please help!
Update
I've looked in my ~/.m2 directory and the dependencies ( in this case core.async ) are present.
Update 2
It would appear that it is the Google Closure Compiler that spews out this error message. Not sure how to provide it a path to the dependencies...
As mentioned in my comment above: if you want to use core.async with ClojureScript you have to require the namespace cljs.core.async (instead of Clojure's clojure.core.async).

Korma not loading JDBC correctly

I would really like to use Korma for my project, but every time I try to test it in my REPL, it throws the following error:
core=> (require 'korma.db)
FileNotFoundException Could not locate clojure/java/jdbc/internal__init.class or clojure/java/jdbc/internal.clj on classpath: clojure.lang.RT.load (RT.java:432)
I have the following in my 'core' namespace:
(ns core
(:require [clojure.java.jdbc :as sql]))
and the following in my project.clj:
(defproject wknd "1.0.0-SNAPSHOT"
:description "weekend side project"
:dependencies [[org.clojure/clojure "1.4.0"]
[org.clojure/clojure-contrib "1.2.0"]
[org.xerial/sqlite-jdbc "3.7.2"]
[org.clojure/java.jdbc "0.2.2"]
[korma "0.3.0-beta9"]]
:dev-dependencies [[org.clojars.scott/lein-nailgun "1.1.0"]])
I am just starting out on clojure and have no idea why I'm getting this error. I've searched around and couldn't find similar issues elsewhere.
From the author:
Korma hadn't been upgraded to the latest JDBC since the reorganization
of it. Try beta11, should be fixed.
Cheers, Chris.
and this error disappeared for me.