Skip to content

Instantly share code, notes, and snippets.

(defproject practice-001 "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojars.amu/lwjgl "2.8.2"]])
Then at "lein repl":
user=> (println (System/getProperty "java.library.path"))
/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
@kiras
kiras / gist:1047989
Created June 26, 2011 21:26
Sierpinski Gasket code
(ns sierpinski.core
(:use [penumbra.opengl])
(:require [penumbra.app :as app])
(:require clojure.contrib.math))
(defn make-point [x y z]
{:x x :y y :z z})
(defn make-triangle [p1 p2 p3]
{:p1 p1 :p2 p2 :p3 p3})
@kiras
kiras / gist:1033674
Created June 19, 2011 02:15
lz-rec-step
(defn lz-rec-step [s]
(lazy-seq
(if (seq s)
[(first s) (lz-rec-step (rest s))]
[])))
(defn close-files [col]
(println "closing files...")
(map #(.close %) col))
(defn -main [& args]
(let [files (ref (list))]
(try
;; User can open files (in which case they will be added to the files list),
;; work on them, close them (in which case they should be removed from the
;; files list), etc.
java -cp "lib/clojure-1.2.0-master-20100623.220259-87.jar;lib/clojure-contrib-1.2.0-20100615.150419-128.jar;D:\xPrograms\leiningen\1.2.0\technomancy-leiningen-1.2.0-RC2-0-g99ed98c\technomancy-leiningen-99ed98c\src" clojure.main -e "(use 'leiningen.core) (-main \"uberjar\")"
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.tools.ant.Project (lancet.clj:22)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5371)
at clojure.lang.Compiler.analyze(Compiler.java:5185)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5352)
at clojure.lang.Compiler.analyze(Compiler.java:5185)
at clojure.lang.Compiler.access$100(Compiler.java:35)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:4916)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5364)
at clojure.lang.Compiler.analyze(Compiler.java:5185)
java -cp "d:/xPrograms/leiningen/1.2.0/leiningen-1.2.0-RC2-standalone.jar;src;classes" leiningen.core uberjar
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: defproject in this context (project.clj:1)
at clojure.lang.Compiler.analyze(Compiler.java:5200)
at clojure.lang.Compiler.analyze(Compiler.java:5146)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3031)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5366)
at clojure.lang.Compiler.analyze(Compiler.java:5185)
at clojure.lang.Compiler.analyze(Compiler.java:5146)
at clojure.lang.Compiler.eval(Compiler.java:5423)
at clojure.lang.Compiler.load(Compiler.java:5852)
lein uberjar error:
lein uberjar
Cleaning up
Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.Exception: Invalid token: d:
at clojure.lang.LispReader.read(LispReader.java:180)
at clojure.core$read.invoke(core.clj:2872)
at clojure.core$read.invoke(core.clj:2870)
at clojure.main$eval_opt.invoke(main.clj:233)
at clojure.main$initialize.invoke(main.clj:254)
project directory structure:
/test-project/classes
/project.clj
/lib
/src/test_project/core.clj
/test
/test-project.jar
/test-project-standalone.jar
;; Code to find all the multiples of 3 or 5 below 1000.
(defn divisible-by-n-list [min max n]
(if-not (zero? n)
(loop [x (* (floor (/ max n)) n)
l (set ())]
(if (> x min)
(recur (- x n) (cons x l))
l))
(println "Cannot divide by zero.")))
Which is right?
lein new test-project
lein new test_project
What is confusing me is that it seems like for filenames and directories, the convention is to use underscores in place of hyphens, while within clojure code itself, hyphens are used.
If this is true, it would seem to suggest the second way is the right way.
However, although all the files and directories follow the underscores instead of hyphens approach when using the second way, the project name in the code does the same. In other words, I get (defproject test_project (etc.)) in project.clj and (ns test_project.core) in core.clj. Is this right? Should it be (defproject test-project) and/or (ns test-project.core) instead?