diff --git a/docs/clay_book.emmy_viewers.html b/docs/clay_book.emmy_viewers.html index d8401fa..c161c7f 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__84286 (js/Function. "y0001" "  return Math.sin(y0001);")]
- [mafs.plot/OfX {:y G__84286}])
+ [G__95022 (js/Function. "y0001" " return Math.sin(y0001);")] + [mafs.plot/OfX {:y G__95022}])

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,18 +276,8 @@

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

Try moving the pink mark. 👆

-
-
(defn my-fn [x]
-  (+ -1
-     (square (sin x))
-     (square (cos (* 2 x)))))
-
-
-
(plot/of-x {:z my-fn :samples 256})
-
-
source: notebooks/clay_book/emmy_viewers.clj
diff --git a/docs/clay_book.examples.html b/docs/clay_book.examples.html index dcdf99a..a8ccd13 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 "babashka", :age 38}
- {:preferred-language "clojure", :age 18}
- {:preferred-language "babashka", :age 2}
- {:preferred-language "clojurescript", :age 76}
- {:preferred-language "babashka", :age 18})
+
({:preferred-language "clojurescript", :age 31}
+ {:preferred-language "clojurescript", :age 42}
+ {:preferred-language "babashka", :age 75}
+ {:preferred-language "clojurescript", :age 21}
+ {:preferred-language "babashka", :age 32})
(take 5 people-as-vectors)
-
(["babashka" 38]
- ["clojure" 18]
- ["babashka" 2]
- ["clojurescript" 76]
- ["babashka" 18])
+
(["clojurescript" 31]
+ ["clojurescript" 42]
+ ["babashka" 75]
+ ["clojurescript" 21]
+ ["babashka" 32])
(->> people-as-vectors
@@ -569,11 +569,11 @@ 

< set)

-
#{["clojurescript" 76]
-  ["clojure" 18]
-  ["babashka" 2]
-  ["babashka" 38]
-  ["babashka" 18]}
+
#{["clojurescript" 42]
+  ["clojurescript" 31]
+  ["babashka" 32]
+  ["clojurescript" 21]
+  ["babashka" 75]}

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.

@@ -862,92 +862,92 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 -babashka +clojure 76 clojure -19 +18 clojurescript -15 +39 -babashka -72 +clojure +19 clojurescript -82 +53 … … -clojure -37 +babashka +5 -clojure -66 +babashka +5 -babashka -87 +clojurescript +10 -clojure -95 +clojurescript +22 -babashka -54 +clojurescript +10 -babashka -81 +clojurescript +80 -clojure -76 +clojurescript +28 clojure -97 +46 clojure -96 +11 -clojurescript -36 +clojure +12 -babashka -36 +clojure +68 @@ -1015,120 +1015,120 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 -babashka +clojure 76 clojure -19 +18 clojurescript -15 +39 -babashka -72 +clojure +19 clojurescript -82 +53 -clojure -19 +clojurescript +40 -babashka -63 +clojure +61 -babashka -18 +clojurescript +34 -clojure -22 +clojurescript +0 clojurescript -38 +96 clojurescript -58 +1 -babashka -0 +clojure +9 babashka -2 +77 -clojure -37 +babashka +5 -clojure -66 +babashka +5 -babashka -87 +clojurescript +10 -clojure -95 +clojurescript +22 -babashka -54 +clojurescript +10 -babashka -81 +clojurescript +80 -clojure -76 +clojurescript +28 clojure -97 +46 clojure -96 +11 -clojurescript -36 +clojure +12 -babashka -36 +clojure +68 @@ -1144,24 +1144,24 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 @@ -1183,24 +1183,24 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 @@ -1222,10 +1222,10 @@

-babashka +clojurescript -clojure +clojurescript babashka @@ -1249,24 +1249,24 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 @@ -1286,24 +1286,24 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 @@ -1372,120 +1372,120 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 -babashka +clojure 76 clojure -19 +18 clojurescript -15 +39 -babashka -72 +clojure +19 clojurescript -82 +53 -clojure -19 +clojurescript +40 -babashka -63 +clojure +61 -babashka -18 +clojurescript +34 -clojure -22 +clojurescript +0 clojurescript -38 +96 clojurescript -58 +1 -babashka -0 +clojure +9 babashka -2 +77 -clojure -37 +babashka +5 -clojure -66 +babashka +5 -babashka -87 +clojurescript +10 -clojure -95 +clojurescript +22 -babashka -54 +clojurescript +10 -babashka -81 +clojurescript +80 -clojure -76 +clojurescript +28 clojure -97 +46 clojure -96 +11 -clojurescript -36 +clojure +12 -babashka -36 +clojure +68 @@ -1508,120 +1508,120 @@

-babashka -38 +clojurescript +31 -clojure -18 +clojurescript +42 babashka -2 +75 clojurescript -76 +21 babashka -18 +32 -babashka +clojure 76 clojure -19 +18 clojurescript -15 +39 -babashka -72 +clojure +19 clojurescript -82 +53 -clojure -19 +clojurescript +40 -babashka -63 +clojure +61 -babashka -18 +clojurescript +34 -clojure -22 +clojurescript +0 clojurescript -38 +96 clojurescript -58 +1 -babashka -0 +clojure +9 babashka -2 +77 -clojure -37 +babashka +5 -clojure -66 +babashka +5 -babashka -87 +clojurescript +10 -clojure -95 +clojurescript +22 -babashka -54 +clojurescript +10 -babashka -81 +clojurescript +80 -clojure -76 +clojurescript +28 clojure -97 +46 clojure -96 +11 -clojurescript -36 +clojure +12 -babashka -36 +clojure +68 @@ -1636,7 +1636,7 @@

-
preferred-languageage
babashka38
clojure18
babashka2
clojurescript76
babashka18
babashka76
clojure19
clojurescript15
babashka72
clojurescript82
clojure19
babashka63
babashka18
clojure22
clojurescript38
clojurescript58
babashka0
babashka2
clojure37
clojure66
babashka87
clojure95
babashka54
babashka81
clojure76
clojure97
clojure96
clojurescript36
babashka36
+
preferred-languageage
clojurescript31
clojurescript42
babashka75
clojurescript21
babashka32
clojure76
clojure18
clojurescript39
clojure19
clojurescript53
clojurescript40
clojure61
clojurescript34
clojurescript0
clojurescript96
clojurescript1
clojure9
babashka77
babashka5
babashka5
clojurescript10
clojurescript22
clojurescript10
clojurescript80
clojurescript28
clojure46
clojure11
clojure12
clojure68

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

-
preferred-languageage
babashka38
clojure18
babashka2
clojurescript76
babashka18
babashka76
clojure19
clojurescript15
babashka72
clojurescript82
clojure19
babashka63
babashka18
clojure22
clojurescript38
clojurescript58
babashka0
babashka2
clojure37
clojure66
babashka87
clojure95
babashka54
babashka81
clojure76
clojure97
clojure96
clojurescript36
babashka36
+
preferred-languageage
clojurescript31
clojurescript42
babashka75
clojurescript21
babashka32
clojure76
clojure18
clojurescript39
clojure19
clojurescript53
clojurescript40
clojure61
clojurescript34
clojurescript0
clojurescript96
clojurescript1
clojure9
babashka77
babashka5
babashka5
clojurescript10
clojurescript22
clojurescript10
clojurescript80
clojurescript28
clojure46
clojure11
clojure12
clojure68

@@ -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.57011365 +0.48039635 1 -0.79487333 +0.56319206 2 -0.49526386 +0.49873960 @@ -2993,7 +2993,7 @@

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

[

_unnamed [3 2]:

+

[

_unnamed [3 2]:

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

<

- + - + - +
00.327164140.39064448
10.532009220.82195591
20.008433860.64312053
diff --git a/docs/index.html b/docs/index.html index 6d77af7..b3cadbf 100644 --- a/docs/index.html +++ b/docs/index.html @@ -458,7 +458,7 @@

[:li "two"] [:li "three"]]])

-
  • one
  • two
  • three
+
  • one
  • two
  • three

A dataset using Tablecloth:

(-> {:x (range 5)
@@ -478,23 +478,23 @@ 

0 -0.14613819 +0.35248573 1 -0.75351583 +0.24611067 2 -0.39909820 +0.77437593 3 -0.39004375 +0.38878768 4 -0.83879682 +0.25555761 @@ -512,7 +512,7 @@

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

-
+

1.8 API

@@ -835,15 +835,15 @@

1.12.1 subsection: purple

-

purple

+

purple

1.12.2 subsection: darkgreen

-

darkgreen

+

darkgreen

1.12.3 subsection: brown

-

brown

+

brown

(->> (range 3)
      kind/fragment)
@@ -879,7 +879,7 @@

(kind/video {:src my-video-src}))})

- +

If the value is a vector, the function is the first element, and the arguments are the rest.

(kind/fn
@@ -918,15 +918,15 @@ 

0 -0.43556098 +0.44193016 1 -0.41201966 +0.96513045 2 -0.23029861 +0.13985408 @@ -949,15 +949,15 @@

0 -0.27786775 +0.92117041 1 -0.90421741 +0.71262621 2 -0.91977493 +0.02511183 @@ -980,15 +980,15 @@

0 -0.31551212 +0.75478921 1 -0.53071865 +0.43860835 2 -0.14320799 +0.14343312 @@ -1016,13 +1016,13 @@

(kind/hiccup
  [:img {:src "notebooks/images/Clay.svg.png"}])

- +
(kind/image
  {:src "notebooks/images/Clay.svg.png"})
- +
(kind/vega-lite
@@ -1037,7 +1037,7 @@ 

:color {:field "species", :type "nominal"}} :background "floralwhite"})

-
+

1.16 Hiding code

diff --git a/docs/search.json b/docs/search.json index a3f12b7..d2c9325 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.14613819\n\n\n1\n0.75351583\n\n\n2\n0.39909820\n\n\n3\n0.39004375\n\n\n4\n0.83879682\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.35248573\n\n\n1\n0.24611067\n\n\n2\n0.77437593\n\n\n3\n0.38878768\n\n\n4\n0.25555761\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.43556098\n\n\n1\n0.41201966\n\n\n2\n0.23029861\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.27786775\n\n\n1\n0.90421741\n\n\n2\n0.91977493\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.31551212\n\n\n1\n0.53071865\n\n\n2\n0.14320799", + "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.44193016\n\n\n1\n0.96513045\n\n\n2\n0.13985408\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.92117041\n\n\n1\n0.71262621\n\n\n2\n0.02511183\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.75478921\n\n\n1\n0.43860835\n\n\n2\n0.14343312", "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 \"babashka\", :age 38}\n {:preferred-language \"clojure\", :age 18}\n {:preferred-language \"babashka\", :age 2}\n {:preferred-language \"clojurescript\", :age 76}\n {:preferred-language \"babashka\", :age 18})\n\n\n(take 5 people-as-vectors)\n\n\n([\"babashka\" 38]\n [\"clojure\" 18]\n [\"babashka\" 2]\n [\"clojurescript\" 76]\n [\"babashka\" 18])\n\n\n(->> people-as-vectors\n (take 5)\n set)\n\n\n#{[\"clojurescript\" 76]\n [\"clojure\" 18]\n [\"babashka\" 2]\n [\"babashka\" 38]\n [\"babashka\" 18]}\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 31}\n {:preferred-language \"clojurescript\", :age 42}\n {:preferred-language \"babashka\", :age 75}\n {:preferred-language \"clojurescript\", :age 21}\n {:preferred-language \"babashka\", :age 32})\n\n\n(take 5 people-as-vectors)\n\n\n([\"clojurescript\" 31]\n [\"clojurescript\" 42]\n [\"babashka\" 75]\n [\"clojurescript\" 21]\n [\"babashka\" 32])\n\n\n(->> people-as-vectors\n (take 5)\n set)\n\n\n#{[\"clojurescript\" 42]\n [\"clojurescript\" 31]\n [\"babashka\" 32]\n [\"clojurescript\" 21]\n [\"babashka\" 75]}\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\n\n\nbabashka\n76\n\n\nclojure\n19\n\n\nclojurescript\n15\n\n\nbabashka\n72\n\n\nclojurescript\n82\n\n\n…\n…\n\n\nclojure\n37\n\n\nclojure\n66\n\n\nbabashka\n87\n\n\nclojure\n95\n\n\nbabashka\n54\n\n\nbabashka\n81\n\n\nclojure\n76\n\n\nclojure\n97\n\n\nclojure\n96\n\n\nclojurescript\n36\n\n\nbabashka\n36\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\n\n\nclojure\n76\n\n\nclojure\n18\n\n\nclojurescript\n39\n\n\nclojure\n19\n\n\nclojurescript\n53\n\n\n…\n…\n\n\nbabashka\n5\n\n\nbabashka\n5\n\n\nclojurescript\n10\n\n\nclojurescript\n22\n\n\nclojurescript\n10\n\n\nclojurescript\n80\n\n\nclojurescript\n28\n\n\nclojure\n46\n\n\nclojure\n11\n\n\nclojure\n12\n\n\nclojure\n68\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\n\n\nbabashka\n76\n\n\nclojure\n19\n\n\nclojurescript\n15\n\n\nbabashka\n72\n\n\nclojurescript\n82\n\n\nclojure\n19\n\n\nbabashka\n63\n\n\nbabashka\n18\n\n\nclojure\n22\n\n\nclojurescript\n38\n\n\nclojurescript\n58\n\n\nbabashka\n0\n\n\nbabashka\n2\n\n\nclojure\n37\n\n\nclojure\n66\n\n\nbabashka\n87\n\n\nclojure\n95\n\n\nbabashka\n54\n\n\nbabashka\n81\n\n\nclojure\n76\n\n\nclojure\n97\n\n\nclojure\n96\n\n\nclojurescript\n36\n\n\nbabashka\n36\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\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\nbabashka\n\n\nclojure\n\n\nbabashka\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\n\n\nbabashka\n76\n\n\nclojure\n19\n\n\nclojurescript\n15\n\n\nbabashka\n72\n\n\nclojurescript\n82\n\n\nclojure\n19\n\n\nbabashka\n63\n\n\nbabashka\n18\n\n\nclojure\n22\n\n\nclojurescript\n38\n\n\nclojurescript\n58\n\n\nbabashka\n0\n\n\nbabashka\n2\n\n\nclojure\n37\n\n\nclojure\n66\n\n\nbabashka\n87\n\n\nclojure\n95\n\n\nbabashka\n54\n\n\nbabashka\n81\n\n\nclojure\n76\n\n\nclojure\n97\n\n\nclojure\n96\n\n\nclojurescript\n36\n\n\nbabashka\n36\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\nbabashka\n38\n\n\nclojure\n18\n\n\nbabashka\n2\n\n\nclojurescript\n76\n\n\nbabashka\n18\n\n\nbabashka\n76\n\n\nclojure\n19\n\n\nclojurescript\n15\n\n\nbabashka\n72\n\n\nclojurescript\n82\n\n\nclojure\n19\n\n\nbabashka\n63\n\n\nbabashka\n18\n\n\nclojure\n22\n\n\nclojurescript\n38\n\n\nclojurescript\n58\n\n\nbabashka\n0\n\n\nbabashka\n2\n\n\nclojure\n37\n\n\nclojure\n66\n\n\nbabashka\n87\n\n\nclojure\n95\n\n\nbabashka\n54\n\n\nbabashka\n81\n\n\nclojure\n76\n\n\nclojure\n97\n\n\nclojure\n96\n\n\nclojurescript\n36\n\n\nbabashka\n36\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-languageagebabashka38clojure18babashka2clojurescript76babashka18babashka76clojure19clojurescript15babashka72clojurescript82clojure19babashka63babashka18clojure22clojurescript38clojurescript58babashka0babashka2clojure37clojure66babashka87clojure95babashka54babashka81clojure76clojure97clojure96clojurescript36babashka36\n\n\n\n(-> people-as-dataset\n (kind/table {:use-datatables true\n :datatables {:scrollY 300}}))\n\n\n\npreferred-languageagebabashka38clojure18babashka2clojurescript76babashka18babashka76clojure19clojurescript15babashka72clojurescript82clojure19babashka63babashka18clojure22clojurescript38clojurescript58babashka0babashka2clojure37clojure66babashka87clojure95babashka54babashka81clojure76clojure97clojure96clojurescript36babashka36", + "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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\n\n\nclojure\n76\n\n\nclojure\n18\n\n\nclojurescript\n39\n\n\nclojure\n19\n\n\nclojurescript\n53\n\n\nclojurescript\n40\n\n\nclojure\n61\n\n\nclojurescript\n34\n\n\nclojurescript\n0\n\n\nclojurescript\n96\n\n\nclojurescript\n1\n\n\nclojure\n9\n\n\nbabashka\n77\n\n\nbabashka\n5\n\n\nbabashka\n5\n\n\nclojurescript\n10\n\n\nclojurescript\n22\n\n\nclojurescript\n10\n\n\nclojurescript\n80\n\n\nclojurescript\n28\n\n\nclojure\n46\n\n\nclojure\n11\n\n\nclojure\n12\n\n\nclojure\n68\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\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\nclojurescript\n\n\nbabashka\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\n\n\nclojure\n76\n\n\nclojure\n18\n\n\nclojurescript\n39\n\n\nclojure\n19\n\n\nclojurescript\n53\n\n\nclojurescript\n40\n\n\nclojure\n61\n\n\nclojurescript\n34\n\n\nclojurescript\n0\n\n\nclojurescript\n96\n\n\nclojurescript\n1\n\n\nclojure\n9\n\n\nbabashka\n77\n\n\nbabashka\n5\n\n\nbabashka\n5\n\n\nclojurescript\n10\n\n\nclojurescript\n22\n\n\nclojurescript\n10\n\n\nclojurescript\n80\n\n\nclojurescript\n28\n\n\nclojure\n46\n\n\nclojure\n11\n\n\nclojure\n12\n\n\nclojure\n68\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\n31\n\n\nclojurescript\n42\n\n\nbabashka\n75\n\n\nclojurescript\n21\n\n\nbabashka\n32\n\n\nclojure\n76\n\n\nclojure\n18\n\n\nclojurescript\n39\n\n\nclojure\n19\n\n\nclojurescript\n53\n\n\nclojurescript\n40\n\n\nclojure\n61\n\n\nclojurescript\n34\n\n\nclojurescript\n0\n\n\nclojurescript\n96\n\n\nclojurescript\n1\n\n\nclojure\n9\n\n\nbabashka\n77\n\n\nbabashka\n5\n\n\nbabashka\n5\n\n\nclojurescript\n10\n\n\nclojurescript\n22\n\n\nclojurescript\n10\n\n\nclojurescript\n80\n\n\nclojurescript\n28\n\n\nclojure\n46\n\n\nclojure\n11\n\n\nclojure\n12\n\n\nclojure\n68\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-languageageclojurescript31clojurescript42babashka75clojurescript21babashka32clojure76clojure18clojurescript39clojure19clojurescript53clojurescript40clojure61clojurescript34clojurescript0clojurescript96clojurescript1clojure9babashka77babashka5babashka5clojurescript10clojurescript22clojurescript10clojurescript80clojurescript28clojure46clojure11clojure12clojure68\n\n\n\n(-> people-as-dataset\n (kind/table {:use-datatables true\n :datatables {:scrollY 300}}))\n\n\n\npreferred-languageageclojurescript31clojurescript42babashka75clojurescript21babashka32clojure76clojure18clojurescript39clojure19clojurescript53clojurescript40clojure61clojurescript34clojurescript0clojurescript96clojurescript1clojure9babashka77babashka5babashka5clojurescript10clojurescript22clojurescript10clojurescript80clojurescript28clojure46clojure11clojure12clojure68", "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.57011365\n\n\n1\n0.79487333\n\n\n2\n0.49526386\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.32716414\n\n\n1\n0.53200922\n\n\n2\n0.00843386\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.48039635\n\n\n1\n0.56319206\n\n\n2\n0.49873960\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.39064448\n\n\n1\n0.82195591\n\n\n2\n0.64312053\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__84286 (js/Function. \"y0001\" \" return Math.sin(y0001);\")]\n [mafs.plot/OfX {:y G__84286}])\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__95022 (js/Function. \"y0001\" \" return Math.sin(y0001);\")]\n [mafs.plot/OfX {:y G__95022}])\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" ] @@ -534,7 +534,7 @@ "href": "clay_book.emmy_viewers.html#more-examples", "title": "3  Emmy-viewers", "section": "3.3 More examples", - "text": "3.3 More examples\n\n(ev/with-let [!phase [0 0]]\n (let [shifted (ev/with-params {:atom !phase :params [0]}\n (fn [shift]\n (fn [x]\n (((cube D) tanh) (e/- x shift)))))]\n (mafs/mafs\n {:height 400}\n (mafs/cartesian)\n (mafs/of-x shifted)\n (mafs/movable-point\n {:atom !phase :constrain \"horizontal\"})\n (mafs/inequality\n {:y {:<= shifted :> cos} :color :blue}))))\n\n\nTry moving the pink mark. 👆\n\n(defn my-fn [x]\n (+ -1\n (square (sin x))\n (square (cos (* 2 x)))))\n\n\n(plot/of-x {:z my-fn :samples 256})\n\n\n\nsource: notebooks/clay_book/emmy_viewers.clj", + "text": "3.3 More examples\n\n(ev/with-let [!phase [0 0]]\n (let [shifted (ev/with-params {:atom !phase :params [0]}\n (fn [shift]\n (fn [x]\n (((cube D) tanh) (e/- x shift)))))]\n (mafs/mafs\n {:height 400}\n (mafs/cartesian)\n (mafs/of-x shifted)\n (mafs/movable-point\n {:atom !phase :constrain \"horizontal\"})\n (mafs/inequality\n {:y {:<= shifted :> cos} :color :blue}))))\n\n\nTry moving the pink mark. 👆\n\nsource: notebooks/clay_book/emmy_viewers.clj", "crumbs": [ "3  Emmy-viewers" ]