diff --git a/docs/clay_book.emmy_viewers.html b/docs/clay_book.emmy_viewers.html index 587219b..44911c1 100644 --- a/docs/clay_book.emmy_viewers.html +++ b/docs/clay_book.emmy_viewers.html @@ -235,7 +235,7 @@

(mafs/of-x e/sin {:color :blue})
-
+

3.2 A few detials behind the scenes

@@ -246,8 +246,8 @@

(reagent.core/with-let
- [G__86251 (js/Function. "y0001" "  return Math.sin(y0001);")]
- [mafs.plot/OfX {:y G__86251}])
+ [G__86802 (js/Function. "y0001" " return Math.sin(y0001);")] + [mafs.plot/OfX {:y G__86802}])

By default, it is inferred to be of :kind/emmy-viewers, and is handle accordingly.

Equivalently, we could also handle it more explicitly with :kind/reagent:

@@ -257,7 +257,7 @@

~(ev/expand (mafs/of-x e/sin)))] {:html/deps [:emmy-viewers]}) -
+

3.3 More examples

@@ -276,7 +276,7 @@

(mafs/inequality {:y {:<= shifted :> cos} :color :blue})))) -
+

Try moving the pink mark. 👆

(defn my-fn [x]
@@ -287,7 +287,7 @@ 

(plot/of-x {:z my-fn :samples 256})

-
+
diff --git a/docs/clay_book.examples.html b/docs/clay_book.examples.html index e5e1c4d..32e1348 100644 --- a/docs/clay_book.examples.html +++ b/docs/clay_book.examples.html @@ -349,7 +349,7 @@

(pr-str (map inc numbers))]) (vec (range 40))])

-
+

From the reagent tutorial:

(kind/reagent
@@ -362,7 +362,7 @@ 

[:input {:type "button" :value "Click me!" :on-click #(swap! *click-count inc)}]])))])

-
+

2.5 HTML

@@ -547,21 +547,21 @@

<
(take 5 people-as-maps)
-
({:preferred-language "clojurescript", :age 74}
- {:preferred-language "babashka", :age 20}
- {:preferred-language "clojurescript", :age 34}
- {:preferred-language "clojurescript", :age 93}
- {:preferred-language "babashka", :age 29})
+
({:preferred-language "clojurescript", :age 96}
+ {:preferred-language "babashka", :age 27}
+ {:preferred-language "clojure", :age 40}
+ {:preferred-language "babashka", :age 97}
+ {:preferred-language "clojure", :age 52})
(take 5 people-as-vectors)
-
(["clojurescript" 74]
- ["babashka" 20]
- ["clojurescript" 34]
- ["clojurescript" 93]
- ["babashka" 29])
+
(["clojurescript" 96]
+ ["babashka" 27]
+ ["clojure" 40]
+ ["babashka" 97]
+ ["clojure" 52])
(->> people-as-vectors
@@ -569,11 +569,11 @@ 

< set)

-
#{["babashka" 29]
-  ["clojurescript" 34]
-  ["clojurescript" 74]
-  ["clojurescript" 93]
-  ["babashka" 20]}
+
#{["clojure" 40]
+  ["clojure" 52]
+  ["babashka" 97]
+  ["babashka" 27]
+  ["clojurescript" 96]}

When something inside needs to be displayed in a special kind of way, the data structures are printed in a way that makes that clear.

@@ -863,43 +863,43 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 -clojurescript -97 +clojure +46 babashka -47 +43 -clojure -56 +babashka +3 -clojurescript -89 +clojure +77 clojure -32 +96 … @@ -907,47 +907,47 @@

clojure -64 +99 -babashka -99 +clojurescript +52 -clojure -35 +clojurescript +12 babashka -4 +73 -babashka -0 +clojure +13 -clojurescript -60 +babashka +76 -clojurescript -51 +clojure +93 -babashka -67 +clojure +70 -clojurescript -75 +clojure +33 clojurescript -7 +21 clojure -51 +86 @@ -1016,119 +1016,119 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 -clojurescript -97 +clojure +46 babashka -47 +43 -clojure -56 +babashka +3 -clojurescript -89 +clojure +77 clojure -32 +96 -clojurescript -76 +babashka +86 -clojurescript -20 +clojure +2 -clojure -49 +babashka +27 -clojurescript -2 +babashka +87 -clojure -58 +babashka +1 -clojure -51 +clojurescript +29 -babashka -6 +clojurescript +3 -babashka -48 +clojure +9 clojure -64 +99 -babashka -99 +clojurescript +52 -clojure -35 +clojurescript +12 babashka -4 +73 -babashka -0 +clojure +13 -clojurescript -60 +babashka +76 -clojurescript -51 +clojure +93 -babashka -67 +clojure +70 -clojurescript -75 +clojure +33 clojurescript -7 +21 clojure -51 +86 @@ -1145,23 +1145,23 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 @@ -1184,23 +1184,23 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 @@ -1228,13 +1228,13 @@

-clojurescript +clojure -clojurescript +babashka -babashka +clojure @@ -1250,23 +1250,23 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 @@ -1287,23 +1287,23 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 @@ -1373,119 +1373,119 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 -clojurescript -97 +clojure +46 babashka -47 +43 -clojure -56 +babashka +3 -clojurescript -89 +clojure +77 clojure -32 +96 -clojurescript -76 +babashka +86 -clojurescript -20 +clojure +2 -clojure -49 +babashka +27 -clojurescript -2 +babashka +87 -clojure -58 +babashka +1 -clojure -51 +clojurescript +29 -babashka -6 +clojurescript +3 -babashka -48 +clojure +9 clojure -64 +99 -babashka -99 +clojurescript +52 -clojure -35 +clojurescript +12 babashka -4 +73 -babashka -0 +clojure +13 -clojurescript -60 +babashka +76 -clojurescript -51 +clojure +93 -babashka -67 +clojure +70 -clojurescript -75 +clojure +33 clojurescript -7 +21 clojure -51 +86 @@ -1509,119 +1509,119 @@

clojurescript -74 +96 babashka -20 +27 -clojurescript -34 +clojure +40 -clojurescript -93 +babashka +97 -babashka -29 +clojure +52 -clojurescript -97 +clojure +46 babashka -47 +43 -clojure -56 +babashka +3 -clojurescript -89 +clojure +77 clojure -32 +96 -clojurescript -76 +babashka +86 -clojurescript -20 +clojure +2 -clojure -49 +babashka +27 -clojurescript -2 +babashka +87 -clojure -58 +babashka +1 -clojure -51 +clojurescript +29 -babashka -6 +clojurescript +3 -babashka -48 +clojure +9 clojure -64 +99 -babashka -99 +clojurescript +52 -clojure -35 +clojurescript +12 babashka -4 +73 -babashka -0 +clojure +13 -clojurescript -60 +babashka +76 -clojurescript -51 +clojure +93 -babashka -67 +clojure +70 -clojurescript -75 +clojure +33 clojurescript -7 +21 clojure -51 +86 @@ -1636,7 +1636,7 @@

-
preferred-languageage
clojurescript74
babashka20
clojurescript34
clojurescript93
babashka29
clojurescript97
babashka47
clojure56
clojurescript89
clojure32
clojurescript76
clojurescript20
clojure49
clojurescript2
clojure58
clojure51
babashka6
babashka48
clojure64
babashka99
clojure35
babashka4
babashka0
clojurescript60
clojurescript51
babashka67
clojurescript75
clojurescript7
clojure51
+
preferred-languageage
clojurescript96
babashka27
clojure40
babashka97
clojure52
clojure46
babashka43
babashka3
clojure77
clojure96
babashka86
clojure2
babashka27
babashka87
babashka1
clojurescript29
clojurescript3
clojure9
clojure99
clojurescript52
clojurescript12
babashka73
clojure13
babashka76
clojure93
clojure70
clojure33
clojurescript21
clojure86

@@ -1646,7 +1646,7 @@

-
preferred-languageage
clojurescript74
babashka20
clojurescript34
clojurescript93
babashka29
clojurescript97
babashka47
clojure56
clojurescript89
clojure32
clojurescript76
clojurescript20
clojure49
clojurescript2
clojure58
clojure51
babashka6
babashka48
clojure64
babashka99
clojure35
babashka4
babashka0
clojurescript60
clojurescript51
babashka67
clojurescript75
clojurescript7
clojure51
+
preferred-languageage
clojurescript96
babashka27
clojure40
babashka97
clojure52
clojure46
babashka43
babashka3
clojure77
clojure96
babashka86
clojure2
babashka27
babashka87
babashka1
clojurescript29
clojurescript3
clojure9
clojure99
clojurescript52
clojurescript12
babashka73
clojure13
babashka76
clojure93
clojure70
clojure33
clojurescript21
clojure86

@@ -1682,7 +1682,7 @@

(random-vega-lite-plot 9)
-
+

When the vega/vega-lite data is given in CSV format, Clay will serve it in a separate CSV file alongside the generated HTML.

(-> {:data {:values "x,y
@@ -2133,7 +2133,7 @@ 

;; Note we need to mention the dependency: {:html/deps [:leaflet]})

-
+

2.21 D3

@@ -2193,7 +2193,7 @@

letter-frequencies] {:html/deps [:d3]})) -
+

2.22 ggplotly

@@ -2390,7 +2390,7 @@

:labels {:x "wt" :y "mpg"}})) -
+

2.23 3DMol.js

@@ -2410,7 +2410,7 @@

;; Note we need to mention the dependency: {:html/deps [:three-d-mol]}) -
+

Using 3Dmol within your code (inspired by these examples):

(defonce pdb-2POR
@@ -2444,7 +2444,7 @@ 

;; Note we need to mention the dependency: {:html/deps [:three-d-mol]})

-
+

2.24 Video

@@ -2505,7 +2505,7 @@

@@ -2807,7 +2807,7 @@

-
kind/vega-lite

kind/vega-lite

kind/reagent
+
kind/vega-lite

kind/vega-lite

kind/reagent

2.27 Nesting kinds in Tables

@@ -2858,7 +2858,7 @@

23
- +
@@ -2911,7 +2911,7 @@

<
- +
@@ -2940,15 +2940,15 @@

< 0 -0.22273732 +0.89649539 1 -0.97981441 +0.69469286 2 -0.73953871 +0.19440003 @@ -2993,7 +2993,7 @@

< :=mark-size 3 :=mark-opacity 0.2}))] -

[

_unnamed [3 2]:

+

[

_unnamed [3 2]:

@@ -3004,15 +3004,15 @@

<

- + - + - +
00.936401680.04557120
10.763661950.24707522
20.238837010.93636611
diff --git a/docs/index.html b/docs/index.html index 736ec52..f654c2e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -458,23 +458,23 @@

0 -0.18395867 +0.56695033 1 -0.76502653 +0.83354480 2 -0.87106059 +0.72773228 3 -0.95932399 +0.54035466 4 -0.57291002 +0.99498313 @@ -897,15 +897,15 @@

0 -0.61981519 +0.36934812 1 -0.99281028 +0.47065716 2 -0.57737433 +0.74349758 @@ -928,15 +928,15 @@

0 -0.16783485 +0.17053104 1 -0.12546182 +0.44608525 2 -0.21197601 +0.77282527 @@ -959,15 +959,15 @@

0 -0.86109950 +0.98421449 1 -0.22400708 +0.52250829 2 -0.58080060 +0.94014335 diff --git a/docs/search.json b/docs/search.json index 07202e5..92a1c4d 100644 --- a/docs/search.json +++ b/docs/search.json @@ -74,7 +74,7 @@ "href": "index.html#example-notebook-namespace", "title": "Clay Documentation", "section": "1.7 Example notebook namespace", - "text": "1.7 Example notebook namespace\nThis notebook is created by a Clojure namespace. Here is the namespace definition and a few examples of what such a namespace may contain.\n\n(ns index\n (:require\n [scicloj.kindly.v4.api :as kindly]\n [scicloj.kindly.v4.kind :as kind]\n [scicloj.clay.v2.quarto.highlight-styles :as quarto.highlight-styles]\n [scicloj.clay.v2.quarto.themes :as quarto.themes]\n [scicloj.metamorph.ml.toydata :as toydata]\n [scicloj.tableplot.v1.hanami :as hanami]\n [tablecloth.api :as tc]\n [clojure.string :as str]))\n\nA Hiccup spec:\n\n(kind/hiccup\n [:div {:style {:background \"#efe9e6\"\n :border-style :solid}}\n [:ul\n [:li \"one\"]\n [:li \"two\"]\n [:li \"three\"]]])\n\nonetwothree\nA dataset using Tablecloth:\n\n(-> {:x (range 5)\n :y (repeatedly 5 rand)}\n tc/dataset\n (tc/set-dataset-name \"my dataset\"))\n\n\nmy dataset [5 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.18395867\n\n\n1\n0.76502653\n\n\n2\n0.87106059\n\n\n3\n0.95932399\n\n\n4\n0.57291002\n\n\n\n\nA plot using Tableplot:\n\n(-> (toydata/iris-ds)\n (hanami/plot hanami/rule-chart\n {:=x :sepal_width\n :=x2 :sepal_length\n :=y :petal_width\n :=y2 :petal_length\n :=color :species\n :=color-type :nominal\n :=mark-size 3\n :=mark-opacity 0.2}))", + "text": "1.7 Example notebook namespace\nThis notebook is created by a Clojure namespace. Here is the namespace definition and a few examples of what such a namespace may contain.\n\n(ns index\n (:require\n [scicloj.kindly.v4.api :as kindly]\n [scicloj.kindly.v4.kind :as kind]\n [scicloj.clay.v2.quarto.highlight-styles :as quarto.highlight-styles]\n [scicloj.clay.v2.quarto.themes :as quarto.themes]\n [scicloj.metamorph.ml.toydata :as toydata]\n [scicloj.tableplot.v1.hanami :as hanami]\n [tablecloth.api :as tc]\n [clojure.string :as str]))\n\nA Hiccup spec:\n\n(kind/hiccup\n [:div {:style {:background \"#efe9e6\"\n :border-style :solid}}\n [:ul\n [:li \"one\"]\n [:li \"two\"]\n [:li \"three\"]]])\n\nonetwothree\nA dataset using Tablecloth:\n\n(-> {:x (range 5)\n :y (repeatedly 5 rand)}\n tc/dataset\n (tc/set-dataset-name \"my dataset\"))\n\n\nmy dataset [5 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.56695033\n\n\n1\n0.83354480\n\n\n2\n0.72773228\n\n\n3\n0.54035466\n\n\n4\n0.99498313\n\n\n\n\nA plot using Tableplot:\n\n(-> (toydata/iris-ds)\n (hanami/plot hanami/rule-chart\n {:=x :sepal_width\n :=x2 :sepal_length\n :=y :petal_width\n :=y2 :petal_length\n :=color :species\n :=color-type :nominal\n :=mark-size 3\n :=mark-opacity 0.2}))", "crumbs": [ "1  Clay" ] @@ -134,7 +134,7 @@ "href": "index.html#functions", "title": "Clay Documentation", "section": "1.13 Functions", - "text": "1.13 Functions\nkind/fn is a special kind. It is displayed by first evaluating a given function and arguments, then proceeding recursively with the resulting value.\nThe function can be specified through the Kindly options.\n\n(kind/fn {:x 1\n :y 2}\n {:kindly/f (fn [{:keys [x y]}]\n (+ x y))})\n\n\n3\n\n\n(kind/fn {:my-video-src \"https://file-examples.com/storage/fe58a1f07d66f447a9512f1/2017/04/file_example_MP4_480_1_5MG.mp4\"}\n {:kindly/f (fn [{:keys [my-video-src]}]\n (kind/video\n {:src my-video-src}))})\n\n\nIf the value is a vector, the function is the first element, and the arguments are the rest.\n\n(kind/fn\n [+ 1 2])\n\n\n3\n\nIf the value is a map, the function is held at the key :kindly/f, and the argument is the map.\n\n(kind/fn\n {:kindly/f (fn [{:keys [x y]}]\n (+ x y))\n :x 1\n :y 2})\n\n\n3\n\nThe kind of the value returned by the function is respected. For example, here are examples with a function returning kind/dataset.\n\n(kind/fn\n {:x (range 3)\n :y (repeatedly 3 rand)}\n {:kindly/f tc/dataset})\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.61981519\n\n\n1\n0.99281028\n\n\n2\n0.57737433\n\n\n\n\n\n(kind/fn\n [tc/dataset\n {:x (range 3)\n :y (repeatedly 3 rand)}])\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.16783485\n\n\n1\n0.12546182\n\n\n2\n0.21197601\n\n\n\n\n\n(kind/fn\n {:kindly/f tc/dataset\n :x (range 3)\n :y (repeatedly 3 rand)})\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.86109950\n\n\n1\n0.22400708\n\n\n2\n0.58080060", + "text": "1.13 Functions\nkind/fn is a special kind. It is displayed by first evaluating a given function and arguments, then proceeding recursively with the resulting value.\nThe function can be specified through the Kindly options.\n\n(kind/fn {:x 1\n :y 2}\n {:kindly/f (fn [{:keys [x y]}]\n (+ x y))})\n\n\n3\n\n\n(kind/fn {:my-video-src \"https://file-examples.com/storage/fe58a1f07d66f447a9512f1/2017/04/file_example_MP4_480_1_5MG.mp4\"}\n {:kindly/f (fn [{:keys [my-video-src]}]\n (kind/video\n {:src my-video-src}))})\n\n\nIf the value is a vector, the function is the first element, and the arguments are the rest.\n\n(kind/fn\n [+ 1 2])\n\n\n3\n\nIf the value is a map, the function is held at the key :kindly/f, and the argument is the map.\n\n(kind/fn\n {:kindly/f (fn [{:keys [x y]}]\n (+ x y))\n :x 1\n :y 2})\n\n\n3\n\nThe kind of the value returned by the function is respected. For example, here are examples with a function returning kind/dataset.\n\n(kind/fn\n {:x (range 3)\n :y (repeatedly 3 rand)}\n {:kindly/f tc/dataset})\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.36934812\n\n\n1\n0.47065716\n\n\n2\n0.74349758\n\n\n\n\n\n(kind/fn\n [tc/dataset\n {:x (range 3)\n :y (repeatedly 3 rand)}])\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.17053104\n\n\n1\n0.44608525\n\n\n2\n0.77282527\n\n\n\n\n\n(kind/fn\n {:kindly/f tc/dataset\n :x (range 3)\n :y (repeatedly 3 rand)})\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.98421449\n\n\n1\n0.52250829\n\n\n2\n0.94014335", "crumbs": [ "1  Clay" ] @@ -304,7 +304,7 @@ "href": "clay_book.examples.html#plain-data-structures", "title": "2  Examples", "section": "2.10 Plain data structures", - "text": "2.10 Plain data structures\nPlain data structures (lists and sequnces, vectors, sets, maps) are pretty printed if there isn’t any value inside which needs to be displayed in special kind of way.\n\n(def people-as-maps\n (->> (range 29)\n (mapv (fn [i]\n {:preferred-language ([\"clojure\" \"clojurescript\" \"babashka\"]\n (rand-int 3))\n :age (rand-int 100)}))))\n\n\n(def people-as-vectors\n (->> people-as-maps\n (mapv (juxt :preferred-language :age))))\n\n\n(take 5 people-as-maps)\n\n\n({:preferred-language \"clojurescript\", :age 74}\n {:preferred-language \"babashka\", :age 20}\n {:preferred-language \"clojurescript\", :age 34}\n {:preferred-language \"clojurescript\", :age 93}\n {:preferred-language \"babashka\", :age 29})\n\n\n(take 5 people-as-vectors)\n\n\n([\"clojurescript\" 74]\n [\"babashka\" 20]\n [\"clojurescript\" 34]\n [\"clojurescript\" 93]\n [\"babashka\" 29])\n\n\n(->> people-as-vectors\n (take 5)\n set)\n\n\n#{[\"babashka\" 29]\n [\"clojurescript\" 34]\n [\"clojurescript\" 74]\n [\"clojurescript\" 93]\n [\"babashka\" 20]}\n\nWhen something inside needs to be displayed in a special kind of way, the data structures are printed in a way that makes that clear.\n\n(def nested-structure-1\n {:vector-of-numbers [2 9 -1]\n :vector-of-different-things [\"hi\"\n (kind/hiccup\n [:big [:big \"hello\"]])]\n :map-of-different-things {:markdown (kind/md [\"*hi*, **hi**\"])\n :number 9999}\n :hiccup (kind/hiccup\n [:big [:big \"bye\"]])\n :dataset (tc/dataset {:x (range 3)\n :y [:A :B :C]})})\n\n\nnested-structure-1\n\n{:vector-of-numbers [2 9 -1]\n\n\n\n\n\n\n\n\n:vector-of-different-things\n\n\n\n[\n\n\n\"hi\"\n\nhello\n\n]\n\n\n\n\n\n\n\n\n\n\n\n\n\n:map-of-different-things\n\n\n\n{\n\n\n\n\n\n\n\n\n\n:markdown\n\n\n\nhi, hi\n\n\n\n\n\n\n:number 9999\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n:hiccup\n\n\nbye\n\n\n\n\n\n\n\n\n\n\n\n\n:dataset\n\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n:A\n\n\n1\n:B\n\n\n2\n:C\n\n\n\n\n\n\n\n\n}", + "text": "2.10 Plain data structures\nPlain data structures (lists and sequnces, vectors, sets, maps) are pretty printed if there isn’t any value inside which needs to be displayed in special kind of way.\n\n(def people-as-maps\n (->> (range 29)\n (mapv (fn [i]\n {:preferred-language ([\"clojure\" \"clojurescript\" \"babashka\"]\n (rand-int 3))\n :age (rand-int 100)}))))\n\n\n(def people-as-vectors\n (->> people-as-maps\n (mapv (juxt :preferred-language :age))))\n\n\n(take 5 people-as-maps)\n\n\n({:preferred-language \"clojurescript\", :age 96}\n {:preferred-language \"babashka\", :age 27}\n {:preferred-language \"clojure\", :age 40}\n {:preferred-language \"babashka\", :age 97}\n {:preferred-language \"clojure\", :age 52})\n\n\n(take 5 people-as-vectors)\n\n\n([\"clojurescript\" 96]\n [\"babashka\" 27]\n [\"clojure\" 40]\n [\"babashka\" 97]\n [\"clojure\" 52])\n\n\n(->> people-as-vectors\n (take 5)\n set)\n\n\n#{[\"clojure\" 40]\n [\"clojure\" 52]\n [\"babashka\" 97]\n [\"babashka\" 27]\n [\"clojurescript\" 96]}\n\nWhen something inside needs to be displayed in a special kind of way, the data structures are printed in a way that makes that clear.\n\n(def nested-structure-1\n {:vector-of-numbers [2 9 -1]\n :vector-of-different-things [\"hi\"\n (kind/hiccup\n [:big [:big \"hello\"]])]\n :map-of-different-things {:markdown (kind/md [\"*hi*, **hi**\"])\n :number 9999}\n :hiccup (kind/hiccup\n [:big [:big \"bye\"]])\n :dataset (tc/dataset {:x (range 3)\n :y [:A :B :C]})})\n\n\nnested-structure-1\n\n{:vector-of-numbers [2 9 -1]\n\n\n\n\n\n\n\n\n:vector-of-different-things\n\n\n\n[\n\n\n\"hi\"\n\nhello\n\n]\n\n\n\n\n\n\n\n\n\n\n\n\n\n:map-of-different-things\n\n\n\n{\n\n\n\n\n\n\n\n\n\n:markdown\n\n\n\nhi, hi\n\n\n\n\n\n\n:number 9999\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n:hiccup\n\n\nbye\n\n\n\n\n\n\n\n\n\n\n\n\n:dataset\n\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n:A\n\n\n1\n:B\n\n\n2\n:C\n\n\n\n\n\n\n\n\n}", "crumbs": [ "2  Examples" ] @@ -324,7 +324,7 @@ "href": "clay_book.examples.html#datasets", "title": "2  Examples", "section": "2.12 Datasets", - "text": "2.12 Datasets\ntech.ml.dataset datasets currently use the default printing of the library,\nLet us create such a dataset using Tablecloth.\n\n(require '[tablecloth.api :as tc])\n\n\n(-> {:x (range 6)\n :y [:A :B :C :A :B :C]}\n tc/dataset)\n\n\n_unnamed [6 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n:A\n\n\n1\n:B\n\n\n2\n:C\n\n\n3\n:A\n\n\n4\n:B\n\n\n5\n:C\n\n\n\n\n\n(-> {:x [1 [2 3] 4]\n :y [:A :B :C]}\n tc/dataset)\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n1\n:A\n\n\n[2 3]\n:B\n\n\n4\n:C\n\n\n\n\n\n(-> [{:x 1 :y 2 :z 3}\n {:y 4 :z 5}]\n tc/dataset)\n\n\n_unnamed [2 3]:\n\n\n\n:x\n:y\n:z\n\n\n\n\n1\n2\n3\n\n\n\n4\n5\n\n\n\n\n\n(-> people-as-maps\n tc/dataset)\n\n\n_unnamed [29 2]:\n\n\n\n:preferred-language\n:age\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\nclojurescript\n97\n\n\nbabashka\n47\n\n\nclojure\n56\n\n\nclojurescript\n89\n\n\nclojure\n32\n\n\n…\n…\n\n\nclojure\n64\n\n\nbabashka\n99\n\n\nclojure\n35\n\n\nbabashka\n4\n\n\nbabashka\n0\n\n\nclojurescript\n60\n\n\nclojurescript\n51\n\n\nbabashka\n67\n\n\nclojurescript\n75\n\n\nclojurescript\n7\n\n\nclojure\n51\n\n\n\n\nSome kind options of kind/dataset control the way a dataset is printed.\n\n(-> {:x (range 30)}\n tc/dataset\n (kind/dataset {:dataset/print-range 6}))\n\n\n_unnamed [30 1]:\n\n\n\n:x\n\n\n\n\n0\n\n\n1\n\n\n2\n\n\n…\n\n\n26\n\n\n27\n\n\n28\n\n\n29", + "text": "2.12 Datasets\ntech.ml.dataset datasets currently use the default printing of the library,\nLet us create such a dataset using Tablecloth.\n\n(require '[tablecloth.api :as tc])\n\n\n(-> {:x (range 6)\n :y [:A :B :C :A :B :C]}\n tc/dataset)\n\n\n_unnamed [6 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n:A\n\n\n1\n:B\n\n\n2\n:C\n\n\n3\n:A\n\n\n4\n:B\n\n\n5\n:C\n\n\n\n\n\n(-> {:x [1 [2 3] 4]\n :y [:A :B :C]}\n tc/dataset)\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n1\n:A\n\n\n[2 3]\n:B\n\n\n4\n:C\n\n\n\n\n\n(-> [{:x 1 :y 2 :z 3}\n {:y 4 :z 5}]\n tc/dataset)\n\n\n_unnamed [2 3]:\n\n\n\n:x\n:y\n:z\n\n\n\n\n1\n2\n3\n\n\n\n4\n5\n\n\n\n\n\n(-> people-as-maps\n tc/dataset)\n\n\n_unnamed [29 2]:\n\n\n\n:preferred-language\n:age\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\nclojure\n46\n\n\nbabashka\n43\n\n\nbabashka\n3\n\n\nclojure\n77\n\n\nclojure\n96\n\n\n…\n…\n\n\nclojure\n99\n\n\nclojurescript\n52\n\n\nclojurescript\n12\n\n\nbabashka\n73\n\n\nclojure\n13\n\n\nbabashka\n76\n\n\nclojure\n93\n\n\nclojure\n70\n\n\nclojure\n33\n\n\nclojurescript\n21\n\n\nclojure\n86\n\n\n\n\nSome kind options of kind/dataset control the way a dataset is printed.\n\n(-> {:x (range 30)}\n tc/dataset\n (kind/dataset {:dataset/print-range 6}))\n\n\n_unnamed [30 1]:\n\n\n\n:x\n\n\n\n\n0\n\n\n1\n\n\n2\n\n\n…\n\n\n26\n\n\n27\n\n\n28\n\n\n29", "crumbs": [ "2  Examples" ] @@ -334,7 +334,7 @@ "href": "clay_book.examples.html#tables", "title": "2  Examples", "section": "2.13 Tables", - "text": "2.13 Tables\nThe :kind/table kind can be handy for an interactive table view. :kind/table understands many structures which can be rendered as a table.\nA map containing either :row-vectors (sequence of sequences) or row-maps (sequence of maps) keys with optional :column-names.\n\n(kind/table\n {:column-names [:preferred-language :age]\n :row-vectors people-as-vectors})\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\nclojurescript\n97\n\n\nbabashka\n47\n\n\nclojure\n56\n\n\nclojurescript\n89\n\n\nclojure\n32\n\n\nclojurescript\n76\n\n\nclojurescript\n20\n\n\nclojure\n49\n\n\nclojurescript\n2\n\n\nclojure\n58\n\n\nclojure\n51\n\n\nbabashka\n6\n\n\nbabashka\n48\n\n\nclojure\n64\n\n\nbabashka\n99\n\n\nclojure\n35\n\n\nbabashka\n4\n\n\nbabashka\n0\n\n\nclojurescript\n60\n\n\nclojurescript\n51\n\n\nbabashka\n67\n\n\nclojurescript\n75\n\n\nclojurescript\n7\n\n\nclojure\n51\n\n\n\n\n\nLack of column names produces table without a header.\n\n(kind/table\n {:row-vectors (take 5 people-as-vectors)})\n\n\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\n\n\n\nColumn names are inferred from a sequence of maps\n\n(kind/table\n {:row-maps (take 5 people-as-maps)})\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\n\n\n\nWe can limit displayed columns for sequence of maps case.\n\n(kind/table\n {:column-names [:preferred-language]\n :row-maps (take 5 people-as-maps)})\n\n\n\n\n\n\npreferred-language\n\n\n\n\nclojurescript\n\n\nbabashka\n\n\nclojurescript\n\n\nclojurescript\n\n\nbabashka\n\n\n\n\n\nSequence of sequences and sequence of maps also work\n\n(kind/table (take 5 people-as-vectors))\n\n\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\n\n\n\n\n(kind/table (take 5 people-as-maps))\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\n\n\n\nAdditionally map of sequences is supported (unless it contains :row-vectors or :row-maps key, see such case above).\n\n(kind/table {:x (range 6)\n :y [:A :B :C :A :B :C]})\n\n\n\n\n\n\nx\ny\n\n\n\n\n0\nA\n\n\n1\nB\n\n\n2\nC\n\n\n3\nA\n\n\n4\nB\n\n\n5\nC\n\n\n\n\n\nA dataset can be also treated as a table input.\n\n(def people-as-dataset\n (tc/dataset people-as-maps))\n\n\n(-> people-as-dataset\n kind/table)\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\nclojurescript\n97\n\n\nbabashka\n47\n\n\nclojure\n56\n\n\nclojurescript\n89\n\n\nclojure\n32\n\n\nclojurescript\n76\n\n\nclojurescript\n20\n\n\nclojure\n49\n\n\nclojurescript\n2\n\n\nclojure\n58\n\n\nclojure\n51\n\n\nbabashka\n6\n\n\nbabashka\n48\n\n\nclojure\n64\n\n\nbabashka\n99\n\n\nclojure\n35\n\n\nbabashka\n4\n\n\nbabashka\n0\n\n\nclojurescript\n60\n\n\nclojurescript\n51\n\n\nbabashka\n67\n\n\nclojurescript\n75\n\n\nclojurescript\n7\n\n\nclojure\n51\n\n\n\n\n\nAdditional options may hint at way the table should be rendered.\n\n(-> people-as-dataset\n (kind/table {:element/max-height \"300px\"}))\n\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n74\n\n\nbabashka\n20\n\n\nclojurescript\n34\n\n\nclojurescript\n93\n\n\nbabashka\n29\n\n\nclojurescript\n97\n\n\nbabashka\n47\n\n\nclojure\n56\n\n\nclojurescript\n89\n\n\nclojure\n32\n\n\nclojurescript\n76\n\n\nclojurescript\n20\n\n\nclojure\n49\n\n\nclojurescript\n2\n\n\nclojure\n58\n\n\nclojure\n51\n\n\nbabashka\n6\n\n\nbabashka\n48\n\n\nclojure\n64\n\n\nbabashka\n99\n\n\nclojure\n35\n\n\nbabashka\n4\n\n\nbabashka\n0\n\n\nclojurescript\n60\n\n\nclojurescript\n51\n\n\nbabashka\n67\n\n\nclojurescript\n75\n\n\nclojurescript\n7\n\n\nclojure\n51\n\n\n\n\n\n\nIt is possible to use datatables to reneder kind/table, and in this case the user may specify datatables options (see the full list).\n\n(-> people-as-maps\n tc/dataset\n (kind/table {:use-datatables true}))\n\n\n\npreferred-languageageclojurescript74babashka20clojurescript34clojurescript93babashka29clojurescript97babashka47clojure56clojurescript89clojure32clojurescript76clojurescript20clojure49clojurescript2clojure58clojure51babashka6babashka48clojure64babashka99clojure35babashka4babashka0clojurescript60clojurescript51babashka67clojurescript75clojurescript7clojure51\n\n\n\n(-> people-as-dataset\n (kind/table {:use-datatables true\n :datatables {:scrollY 300}}))\n\n\n\npreferred-languageageclojurescript74babashka20clojurescript34clojurescript93babashka29clojurescript97babashka47clojure56clojurescript89clojure32clojurescript76clojurescript20clojure49clojurescript2clojure58clojure51babashka6babashka48clojure64babashka99clojure35babashka4babashka0clojurescript60clojurescript51babashka67clojurescript75clojurescript7clojure51", + "text": "2.13 Tables\nThe :kind/table kind can be handy for an interactive table view. :kind/table understands many structures which can be rendered as a table.\nA map containing either :row-vectors (sequence of sequences) or row-maps (sequence of maps) keys with optional :column-names.\n\n(kind/table\n {:column-names [:preferred-language :age]\n :row-vectors people-as-vectors})\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\nclojure\n46\n\n\nbabashka\n43\n\n\nbabashka\n3\n\n\nclojure\n77\n\n\nclojure\n96\n\n\nbabashka\n86\n\n\nclojure\n2\n\n\nbabashka\n27\n\n\nbabashka\n87\n\n\nbabashka\n1\n\n\nclojurescript\n29\n\n\nclojurescript\n3\n\n\nclojure\n9\n\n\nclojure\n99\n\n\nclojurescript\n52\n\n\nclojurescript\n12\n\n\nbabashka\n73\n\n\nclojure\n13\n\n\nbabashka\n76\n\n\nclojure\n93\n\n\nclojure\n70\n\n\nclojure\n33\n\n\nclojurescript\n21\n\n\nclojure\n86\n\n\n\n\n\nLack of column names produces table without a header.\n\n(kind/table\n {:row-vectors (take 5 people-as-vectors)})\n\n\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\n\n\n\nColumn names are inferred from a sequence of maps\n\n(kind/table\n {:row-maps (take 5 people-as-maps)})\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\n\n\n\nWe can limit displayed columns for sequence of maps case.\n\n(kind/table\n {:column-names [:preferred-language]\n :row-maps (take 5 people-as-maps)})\n\n\n\n\n\n\npreferred-language\n\n\n\n\nclojurescript\n\n\nbabashka\n\n\nclojure\n\n\nbabashka\n\n\nclojure\n\n\n\n\n\nSequence of sequences and sequence of maps also work\n\n(kind/table (take 5 people-as-vectors))\n\n\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\n\n\n\n\n(kind/table (take 5 people-as-maps))\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\n\n\n\nAdditionally map of sequences is supported (unless it contains :row-vectors or :row-maps key, see such case above).\n\n(kind/table {:x (range 6)\n :y [:A :B :C :A :B :C]})\n\n\n\n\n\n\nx\ny\n\n\n\n\n0\nA\n\n\n1\nB\n\n\n2\nC\n\n\n3\nA\n\n\n4\nB\n\n\n5\nC\n\n\n\n\n\nA dataset can be also treated as a table input.\n\n(def people-as-dataset\n (tc/dataset people-as-maps))\n\n\n(-> people-as-dataset\n kind/table)\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\nclojure\n46\n\n\nbabashka\n43\n\n\nbabashka\n3\n\n\nclojure\n77\n\n\nclojure\n96\n\n\nbabashka\n86\n\n\nclojure\n2\n\n\nbabashka\n27\n\n\nbabashka\n87\n\n\nbabashka\n1\n\n\nclojurescript\n29\n\n\nclojurescript\n3\n\n\nclojure\n9\n\n\nclojure\n99\n\n\nclojurescript\n52\n\n\nclojurescript\n12\n\n\nbabashka\n73\n\n\nclojure\n13\n\n\nbabashka\n76\n\n\nclojure\n93\n\n\nclojure\n70\n\n\nclojure\n33\n\n\nclojurescript\n21\n\n\nclojure\n86\n\n\n\n\n\nAdditional options may hint at way the table should be rendered.\n\n(-> people-as-dataset\n (kind/table {:element/max-height \"300px\"}))\n\n\n\n\n\n\n\npreferred-language\nage\n\n\n\n\nclojurescript\n96\n\n\nbabashka\n27\n\n\nclojure\n40\n\n\nbabashka\n97\n\n\nclojure\n52\n\n\nclojure\n46\n\n\nbabashka\n43\n\n\nbabashka\n3\n\n\nclojure\n77\n\n\nclojure\n96\n\n\nbabashka\n86\n\n\nclojure\n2\n\n\nbabashka\n27\n\n\nbabashka\n87\n\n\nbabashka\n1\n\n\nclojurescript\n29\n\n\nclojurescript\n3\n\n\nclojure\n9\n\n\nclojure\n99\n\n\nclojurescript\n52\n\n\nclojurescript\n12\n\n\nbabashka\n73\n\n\nclojure\n13\n\n\nbabashka\n76\n\n\nclojure\n93\n\n\nclojure\n70\n\n\nclojure\n33\n\n\nclojurescript\n21\n\n\nclojure\n86\n\n\n\n\n\n\nIt is possible to use datatables to reneder kind/table, and in this case the user may specify datatables options (see the full list).\n\n(-> people-as-maps\n tc/dataset\n (kind/table {:use-datatables true}))\n\n\n\npreferred-languageageclojurescript96babashka27clojure40babashka97clojure52clojure46babashka43babashka3clojure77clojure96babashka86clojure2babashka27babashka87babashka1clojurescript29clojurescript3clojure9clojure99clojurescript52clojurescript12babashka73clojure13babashka76clojure93clojure70clojure33clojurescript21clojure86\n\n\n\n(-> people-as-dataset\n (kind/table {:use-datatables true\n :datatables {:scrollY 300}}))\n\n\n\npreferred-languageageclojurescript96babashka27clojure40babashka97clojure52clojure46babashka43babashka3clojure77clojure96babashka86clojure2babashka27babashka87babashka1clojurescript29clojurescript3clojure9clojure99clojurescript52clojurescript12babashka73clojure13babashka76clojure93clojure70clojure33clojurescript21clojure86", "crumbs": [ "2  Examples" ] @@ -484,7 +484,7 @@ "href": "clay_book.examples.html#more-nesting-examples", "title": "2  Examples", "section": "2.28 More nesting examples", - "text": "2.28 More nesting examples\n\n{:plot (random-vega-lite-plot 9)\n :dataset (tc/dataset {:x (range 3)\n :y (repeatedly 3 rand)})\n :arithmetic (kind/fn [+ 1 2])}\n\n{\n\n\n\n\n\n\n\n\n:plot\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n:dataset\n\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.22273732\n\n\n1\n0.97981441\n\n\n2\n0.73953871\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n:arithmetic\n\n\n\n3\n\n\n\n\n\n}\n\n[(random-vega-lite-plot 9)\n (tc/dataset {:x (range 3)\n :y (repeatedly 3 rand)})\n (kind/fragment [(+ 1 2)\n (+ 3 4)])\n (-> (toydata/iris-ds)\n (hanami/plot hanami/rule-chart\n {:=x :sepal_width\n :=x2 :sepal_length\n :=y :petal_width\n :=y2 :petal_length\n :=color :species\n :=color-type :nominal\n :=mark-size 3\n :=mark-opacity 0.2}))]\n\n[_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.93640168\n\n\n1\n0.76366195\n\n\n2\n0.23883701\n\n\n\n3\n7\n]", + "text": "2.28 More nesting examples\n\n{:plot (random-vega-lite-plot 9)\n :dataset (tc/dataset {:x (range 3)\n :y (repeatedly 3 rand)})\n :arithmetic (kind/fn [+ 1 2])}\n\n{\n\n\n\n\n\n\n\n\n:plot\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n:dataset\n\n\n\n_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.89649539\n\n\n1\n0.69469286\n\n\n2\n0.19440003\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n:arithmetic\n\n\n\n3\n\n\n\n\n\n}\n\n[(random-vega-lite-plot 9)\n (tc/dataset {:x (range 3)\n :y (repeatedly 3 rand)})\n (kind/fragment [(+ 1 2)\n (+ 3 4)])\n (-> (toydata/iris-ds)\n (hanami/plot hanami/rule-chart\n {:=x :sepal_width\n :=x2 :sepal_length\n :=y :petal_width\n :=y2 :petal_length\n :=color :species\n :=color-type :nominal\n :=mark-size 3\n :=mark-opacity 0.2}))]\n\n[_unnamed [3 2]:\n\n\n\n:x\n:y\n\n\n\n\n0\n0.04557120\n\n\n1\n0.24707522\n\n\n2\n0.93636611\n\n\n\n3\n7\n]", "crumbs": [ "2  Examples" ] @@ -524,7 +524,7 @@ "href": "clay_book.emmy_viewers.html#a-few-detials-behind-the-scenes", "title": "3  Emmy-viewers", "section": "3.2 A few detials behind the scenes", - "text": "3.2 A few detials behind the scenes\nIn the example above, we used emmy-viewers to generate a Clojurescript expression that can be interpreted as a Reagent component. Here is the actual expression:\n\n(kind/pprint\n (mafs/of-x e/sin))\n\n\n(reagent.core/with-let\n [G__86251 (js/Function. \"y0001\" \" return Math.sin(y0001);\")]\n [mafs.plot/OfX {:y G__86251}])\n\nBy default, it is inferred to be of :kind/emmy-viewers, and is handle accordingly.\nEquivalently, we could also handle it more explicitly with :kind/reagent:\n\n(kind/reagent\n [`(fn []\n ~(ev/expand (mafs/of-x e/sin)))]\n {:html/deps [:emmy-viewers]})", + "text": "3.2 A few detials behind the scenes\nIn the example above, we used emmy-viewers to generate a Clojurescript expression that can be interpreted as a Reagent component. Here is the actual expression:\n\n(kind/pprint\n (mafs/of-x e/sin))\n\n\n(reagent.core/with-let\n [G__86802 (js/Function. \"y0001\" \" return Math.sin(y0001);\")]\n [mafs.plot/OfX {:y G__86802}])\n\nBy default, it is inferred to be of :kind/emmy-viewers, and is handle accordingly.\nEquivalently, we could also handle it more explicitly with :kind/reagent:\n\n(kind/reagent\n [`(fn []\n ~(ev/expand (mafs/of-x e/sin)))]\n {:html/deps [:emmy-viewers]})", "crumbs": [ "3  Emmy-viewers" ]