Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add first draft for the clerks notebooks #546

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ out/
/.settings
.classpath
/.clj-kondo
/.clerk
64 changes: 33 additions & 31 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@
:paths ["src" "target/classes"]

:deps/prep-lib {:ensure "target/classes"
:alias :build
:fn compile}
:alias :build
:fn compile}

:aliases {:1.9 {:override-deps {org.clojure/clojure {:mvn/version "1.9.0"}}}

:1.10 {:override-deps {org.clojure/clojure {:mvn/version "1.10.0"}}}

:dev {:extra-paths ["dev" "benchmark/src"]
:extra-deps {org.clojure/tools.namespace {:mvn/version "1.2.0"}
clj-http/clj-http {:mvn/version "3.12.3"}
org.clojure/tools.cli {:mvn/version "1.0.206"}
incanter/incanter-core {:mvn/version "1.9.3"}
incanter/incanter-charts {:mvn/version "1.9.3"}}}
:extra-deps {org.clojure/tools.namespace {:mvn/version "1.2.0"}
clj-http/clj-http {:mvn/version "3.12.3"}
criterium/criterium {:mvn/version "0.4.6"}
org.clojure/tools.cli {:mvn/version "1.0.206"}
io.github.nextjournal/clerk {:mvn/version "0.11.603"}
incanter/incanter-core {:mvn/version "1.9.3"}
incanter/incanter-charts {:mvn/version "1.9.3"}}}

:test {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "1.70.1086"}
Expand All @@ -39,44 +41,44 @@
:repl {:extra-deps {cider/cider-nrepl {:mvn/version "0.28.3"}
nrepl/nrepl {:mvn/version "0.9.0"}
org.clojure/tools.namespace {:mvn/version "1.2.0"}}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}

:bench-dev {:extra-paths ["benchmark/src" "benchmark/test"]
:extra-deps {clj-http/clj-http {:mvn/version "3.12.3"}
org.clojure/tools.cli {:mvn/version "1.0.206"}}}
:extra-deps {clj-http/clj-http {:mvn/version "3.12.3"}
org.clojure/tools.cli {:mvn/version "1.0.206"}}}

:benchmark {:main-opts ["-m" "benchmark.core"]
:benchmark {:main-opts ["-m" "benchmark.core"]
:extra-paths ["benchmark/src"]
:extra-deps {clj-http/clj-http {:mvn/version "3.12.3"}
org.clojure/tools.cli {:mvn/version "1.0.206"}
incanter/incanter-core {:mvn/version "1.9.3"}
incanter/incanter-charts {:mvn/version "1.9.3"}}}
:extra-deps {clj-http/clj-http {:mvn/version "3.12.3"}
org.clojure/tools.cli {:mvn/version "1.0.206"}
incanter/incanter-core {:mvn/version "1.9.3"}
incanter/incanter-charts {:mvn/version "1.9.3"}}}

:datomic {:extra-deps {com.datomic/datomic-free {:mvn/version "0.9.5703"}}}

:deploy {:extra-deps {slipset/deps-deploy {:mvn/version "0.2.0"}}
:main-opts ["-m" "deps-deploy.deps-deploy" "deploy" "replikativ-datahike.jar"]}
:main-opts ["-m" "deps-deploy.deps-deploy" "deploy" "replikativ-datahike.jar"]}

:deps-consistency {:extra-paths ["tools"]
:extra-deps {org.clojure/tools.cli {:mvn/version "1.0.206"}}
:main-opts ["-m" "dependencies-consistency-check" "-a" "dev" "-a" "test"]}
:extra-deps {org.clojure/tools.cli {:mvn/version "1.0.206"}}
:main-opts ["-m" "dependencies-consistency-check" "-a" "dev" "-a" "test"]}

:install {:extra-deps {slipset/deps-deploy {:mvn/version "0.2.0"}}
:exec-fn deps-deploy.deps-deploy/deploy
:exec-args {:installer :local
:artifact "replikativ-datahike.jar"}}
:exec-fn deps-deploy.deps-deploy/deploy
:exec-args {:installer :local
:artifact "replikativ-datahike.jar"}}

:format {:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}
:main-opts ["-m" "cljfmt.main" "check"]}
:main-opts ["-m" "cljfmt.main" "check"]}

:ffix {:extra-deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}
:main-opts ["-m" "cljfmt.main" "fix"]}

:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}
slipset/deps-deploy {:mvn/version "0.2.0"}
borkdude/gh-release-artifact {:git/url "https://github.com/borkdude/gh-release-artifact"
:sha "a83ee8da47d56a80b6380cbb6b4b9274048067bd"}
babashka/babashka.curl {:mvn/version "0.1.2"}
babashka/fs {:mvn/version "0.1.4"}
cheshire/cheshire {:mvn/version "5.10.2"}}
:main-opts ["-m" "cljfmt.main" "fix"]}

:build {:deps {io.github.clojure/tools.build {:git/tag "v0.8.1" :git/sha "7d40500"}
slipset/deps-deploy {:mvn/version "0.2.0"}
borkdude/gh-release-artifact {:git/url "https://github.com/borkdude/gh-release-artifact"
:sha "a83ee8da47d56a80b6380cbb6b4b9274048067bd"}
babashka/babashka.curl {:mvn/version "0.1.2"}
babashka/fs {:mvn/version "0.1.4"}
cheshire/cheshire {:mvn/version "5.10.2"}}
:ns-default build}}}
43 changes: 31 additions & 12 deletions dev/sandbox.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,24 @@
:schema-flexibility :write
:attribute-refs? false})

(def cfg {:store {:backend :mem :id "sandbox"}
:keep-history? true
:schema-flexibility :write
:attribute-refs? true})

(def conn (do
(d/delete-database cfg)
(d/create-database cfg)
(d/connect cfg)))

(d/transact conn schema)

(d/datoms @conn :avet)
(d/datoms @conn :aevt)
(d/datoms @conn :eavt)

(:max-eid @conn)

(d/transact conn [{:name "Alice"
:age 25}])

(d/transact conn [{:name "Bob"
:age 35}])

(d/pull @conn '[*] [:name "Alice"])

(d/transact conn [{:name "Charlie"
:age 45
:sibling [{:name "Alice"} {:name "Bob"}]}])
:sibling [[:name "Alice"] [:name "Bob"]]}])

(d/q '[:find ?e ?a ?v ?t
:in $ ?a
Expand All @@ -53,6 +47,12 @@
@conn
25)

(d/pull @conn '[* {:sibling [* {:sibling [*]}]}] [:name "Charlie"])

(def db-data (select-keys @conn [:meta :config :max-eid :max-tx :hash]))

(:config db-data)

(d/q '[:find ?e ?at ?v
:where
[?e ?a ?v]
Expand Down Expand Up @@ -80,3 +80,22 @@
:where [?e1 :name ?v1] [?e2 :name ?v2]]
:args [@conn]})
nil)))


;; Clerk drafts

(comment
(require '[nextjournal.clerk :as clerk])

(clerk/serve! {:browse? true})

(clerk/clear-cache!)

(clerk/show! "notebooks/crash_course.clj")
(clerk/show! "notebooks/schema.clj")
(clerk/show! "notebooks/store.clj")
;; there are race conditions somehwere when creating and deleting many dbs
(clerk/show! "notebooks/time_travel.clj")
(clerk/show! "notebooks/time_variance.clj"))


12 changes: 0 additions & 12 deletions examples/basic/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions examples/basic/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions examples/basic/deps.edn

This file was deleted.

13 changes: 0 additions & 13 deletions examples/basic/docker-compose.yml

This file was deleted.

61 changes: 0 additions & 61 deletions examples/basic/src/examples/core.clj

This file was deleted.

75 changes: 0 additions & 75 deletions examples/basic/src/examples/store.clj

This file was deleted.

Loading