For the crux tutorial I can do lein new <make-up-name>
?
The crux docs say Leinigen and Clojure CLI tools can be used https://juxt.pro/blog/crux-tutorial-setup#project So you could do something like
lein new app practicalli/crux-demo
I havent used Leiningen for a year, but that seemed to work okay when I tested it.
Then you need to add the crux dependency and namespace, as defined in the link above.yep, that was what I thougth
hmm, second question
the tutorial is talking about a deps.edn
but i cannot find it on the lein project
and why is Gold not foundhere :
(ns practicalli.earth
(:require [crux.api :as crux]))
(def node (crux/start-node {}))
(defn easy-ingest
"Uses Crux put transaction to add a vector of documents to a specified
node"
[node docs]
(crux/submit-tx node (mapv (fn [doc] [:crux.tx/put doc]) docs)))
(def manifest
{:crux.db/id :manifest
:pilot-name "Johanna"
:id/rocket "SB002-sol"
:id/employee "22910x2"
:badges "SETUP"
:cargo ["stereo" "gold fish" "slippers" "secret note"]})
(crux/submit-tx
node
[[:crux.tx/put
(assoc manifest :badges ["SETUP" "PUT"])]])
[{:crux.db/id :commodity/Pu
:common-name "Plutonium"
:type :element/metal
:density 19.816
:radioactive true}
{:crux.db/id :commodity/N
:common-name "Nitrogen"
:type :element/gas
:density 1.2506
:radioactive false}
{:crux.db/id :commodity/CH4
:common-name "Methane"
:type :molecule/gas
:density 0.717
:radioactive false}
{:crux.db/id :commodity/Au
:common-name "Gold"
:type :element/metal
:density 19.300
:radioactive false}
{:crux.db/id :commodity/C
:common-name "Carbon"
:type :element/non-metal
:density 2.267
:radioactive false}
{:crux.db/id :commodity/borax
:common-name "Borax"
:IUPAC-name "Sodium tetraborate decahydrate"
:other-names ["Borax decahydrate" "sodium borate"
"sodium tetraborate" "disodium tetraborate"]
:type :mineral/solid
:appearance "white solid"
:density 1.73
:radioactive false}]
(crux/q (crux/db node)
'{:find [element]
:where [[element :type :element/metal]]})
hmm, what is the advantage of using a .edn file instead of using the clojure.clj file as in a lein project ?
Leiningen is a tool that uses project.clj to configure Clojure projects. Clojure CLI tools uses a deps.edn file to configure Clojure projects. The Clojure code in the project should be the same, regardless of how a project is configured. Try the #crux channel for questions about the tutorial or using crux (I'm offline until the morning)
To someone starting Clojure, there is very little difference between the two tools. Leiningen has been around for many years and has a number of plugins to add features. Clojure CLI tools is relatively new and is a simpler tool that uses aliases to include extra features.
oke, then I have to learn how to make a project with clojure cli