Skip to content

Commit 8e26d95

Browse files
finalize macroexpand workshop post
1 parent faa4ddf commit 8e26d95

File tree

2 files changed

+63
-15
lines changed

2 files changed

+63
-15
lines changed
315 KB
Loading

src/scicloj/clay/workshop/macroexpand2025.clj

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,40 @@
22
:clay {:title "Macroexpand 2025 Noj: Clay Workshop"
33
:quarto {:author :timothypratley
44
:description "What is Clay, why use it, and how to use it."
5-
:draft true
65
:type :post
76
:date "2025-10-16"
87
:category :clay
98
:tags [:clay :workflow]}}}
109
(ns scicloj.clay.workshop.macroexpand2025
1110
(:require [scicloj.tableplot.v1.plotly :as tp]
12-
[tablecloth.api :as tc]))
11+
[tablecloth.api :as tc]
12+
[scicloj.kindly.v4.kind :as kind]))
1313

1414
(ns scicloj.clay.workshop.macroexpand2025)
1515

16-
;; The purpose of this workshop is to get up and running with Clay.
17-
;; So please ask for help if you are stuck or have any questions.
16+
;; Welcome to the [Macroexpand Clay Workshop](https://scicloj.github.io/macroexpand-2025/macroexpand_noj.html)!
17+
18+
;; The main goal of this workshop is to get you up and running with Clay.
19+
;; I'll present an overview of Clay, and then we'll spend time together getting setup and trying it.
20+
;; Please ask for help if you are stuck or have any questions.
1821

1922
;; ## What is Clay?
2023

2124
;; Clay is a tool that turns a Clojure namespace into a Document.
22-
;; This document was made from the `scicloj.clay.workshop.macroexpand2025` namespace.
2325

2426
;; Clay renders code, results, comments, markdown and visualizations.
2527

2628
;; ![Clay makes code into a document](macroexpand2025.png)
2729

30+
;; > Useful for documentation, data exploration, visualization, and blogging.
31+
32+
;; > Bundled with Noj; the SciCloj collection of data science libraries.
33+
34+
;; ## What does Clay produce?
35+
36+
;; HTML or Markdown of comments, code, and values.
37+
;; This HTML document was made from `src/scicloj/clay/workshop/macroexpand2025.clj`.
38+
2839
;; ### Code and results
2940

3041
;; Expressions are evaluated and the result shown in the document.
@@ -55,7 +66,9 @@
5566

5667
;; ![hammer and spanner](macroexpand2025.svg)
5768

58-
;; See [Markdown reference](https://quarto.org/docs/authoring/markdown-basics.html).
69+
;; CommonMark (Quarto).
70+
;; Quarto has features like footnotes^[Quarto is a well established, widely used publishing solution].
71+
;; See [Markdown reference](https://quarto.org/docs/authoring/markdown-basics.html) for the full feature set.
5972

6073
;; ### Visualizations
6174

@@ -101,6 +114,21 @@
101114
[:circle {:r 40 :cx 50 :cy 50 :fill "lightblue"}]
102115
[:circle {:r 20 :cx 50 :cy 50 :fill "lightgreen"}]]
103116

117+
;; Anything you can do in a web page can be expressed as hiccup, such as including JavaScript in the page.
118+
119+
^:kind/hiccup
120+
[:script {:src "https://cdn.jsdelivr.net/npm/scittle-kitchen/dist/scittle.js"}]
121+
122+
;; `^:kind/hiccup` is Clojure syntax for attaching metadata.
123+
;; Kindly is a standard for annotation, and helpers for attaching metadata annotations.
124+
125+
(kind/hiccup
126+
[:svg {:width "100%"}
127+
[:circle {:r 40 :cx 50 :cy 50 :fill "lightblue"}]
128+
[:circle {:r 20 :cx 50 :cy 50 :fill "lightgreen"}]])
129+
130+
;; Metadata on values for visualization tools like Clay to know what to do with the value.
131+
104132
;; ## So - Notebooks?
105133

106134
;; Yes, Clay interleaves code, results, narrative and visualizations.
@@ -109,12 +137,15 @@
109137

110138
;; But, there is no execution model or environment.
111139

112-
;; > It's your Clojure code, the way you usually write it.
140+
;; > You write plain Clojure code, you can run it without Clay.
141+
142+
;; Clay is not a dependency of your code.
143+
144+
;; > Write with your normal workflow, sometimes using Clay to visualize as you go.
113145

114-
;; Clay is not _required_ by your code.
115146
;; Clay takes code as input and makes a document.
116147

117-
;; > Produces **HTML**, PDF, presentations and Markdown.
148+
;; > Produces **HTML** or Markdown which may be further processed into PDF, slides, or websites.
118149

119150
;; ## Why make documents from code?
120151

@@ -125,7 +156,7 @@
125156
;; | Sharing ideas is important | Foundation of human progress. Fuels technology, communities, and civilization. |
126157
;; | Code crystallizes thinking | Concrete, logical, reproducible, explorable, and extensible. |
127158
;; | Edit code not documents | Thinking and coding is the hard part. |
128-
;; | Publishing matters | Share your idea in a widely accessible format. |
159+
;; | Publishing matters | Share your idea in a widely accessible formats. |
129160

130161
;; ## Why use Clay?
131162

@@ -138,6 +169,10 @@
138169
;; | Publishing | Notebook | Markdown |
139170
;; : Clay is _simple_
140171

172+
;; People really enjoy the workflow and results.
173+
174+
;; > "Best notebook experience I've had"
175+
141176
;; ## How to Clay
142177

143178
;; To use Clay is to send it some code.
@@ -168,6 +203,11 @@
168203
;; by searching for "Clay".
169204
;; I highly recommend creating a custom keybinding that works with your configuration.
170205

206+
;; A browser window will be shown when you call Clay.
207+
;; ![Cursive and Calva have an embedded viewer](macroexpand2025-editor.png)
208+
209+
;; ### Anyone stuck?
210+
171211
;; If you are having difficulty getting started,
172212
;; you might find it easier to clone an existing project:
173213

@@ -178,7 +218,7 @@
178218

179219
;; ### Live reload
180220

181-
;; Clay can watch for file changes and re-render document.
221+
;; Clay can watch for file changes and re-render the document.
182222
;; Use the "Clay watch" REPL command to toggle live reload mode.
183223

184224
;; Create or edit a source file and it will be shown in the browser.
@@ -197,7 +237,7 @@
197237

198238
;; ## Ideas for explorations
199239

200-
;; The purpose of this Workshop is to encourage you to create your own namespace and use clay to render it.
240+
;; Take some time to create your own namespace and use Clay to render it.
201241
;; Here are some tiny ideas you might write about.
202242

203243
;; ### What is macroexpand?
@@ -229,9 +269,17 @@ freq
229269

230270
(-> scatter-ds
231271
(tp/base {:=title "Sample Scatter Plot"})
232-
(tp/layer-point {:=x :x
233-
:=y :y}))
272+
(tp/layer-point {:=x :x
273+
:=y :y}))
234274

235275
;; ## Question time
236276

237-
;; Stuck? Need help? Please speak up!
277+
;; Please speak up!
278+
;; Stuck?
279+
;; Need help?
280+
;; Want to see a feature demonstrated?
281+
;; Questions about configuration, Quarto, Markdown, formats, narrowing?
282+
;; Feature suggestions?
283+
;; Share your experiences?
284+
285+
;; Remaining questions can be asked in the [#clay-dev channel](https://clojurians.zulipchat.com/#narrow/channel/422115-clay-dev).

0 commit comments

Comments
 (0)