practicalli

https://practicalli.github.io/ http://yt.vu/+practicalli (youtube)
roelof 2020-12-31T18:23:41.312500Z

For the crux tutorial I can do lein new <make-up-name> ?

practicalli-john 2020-12-31T18:43:13.315Z

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.

roelof 2020-12-31T18:49:18.315500Z

yep, that was what I thougth

roelof 2020-12-31T18:55:20.315700Z

hmm, second question

roelof 2020-12-31T18:55:36.316200Z

the tutorial is talking about a deps.edn

roelof 2020-12-31T18:55:53.316700Z

but i cannot find it on the lein project

roelof 2020-12-31T19:18:34.318100Z

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]]})

roelof 2020-12-31T20:05:16.319100Z

hmm, what is the advantage of using a .edn file instead of using the clojure.clj file as in a lein project ?

practicalli-john 2020-12-31T20:33:53.323200Z

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)

practicalli-john 2020-12-31T20:41:33.323300Z

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.

roelof 2020-12-31T21:20:32.323500Z

oke, then I have to learn how to make a project with clojure cli