|
| 1 | +(ns index |
| 2 | + {:nextjournal.clerk/visibility {:code :hide}} |
| 3 | + (:require |
| 4 | + [noc.render] |
| 5 | + [noc.clerk-ext :as clerk-ext] |
| 6 | + [nextjournal.clerk :as clerk] |
| 7 | + [clojure.java.io :as io])) |
| 8 | + |
| 9 | +;; # Nature of Code in Clojure |
| 10 | + |
| 11 | +;; |
| 12 | + |
| 13 | +(clerk/html |
| 14 | + [:div {:class "md:flex md:flex-row md:gap-4"} |
| 15 | + [:div {:class "flex items-center justify-center flex-auto not-prose max-w-48"} |
| 16 | + (noc.render/image-ext {:width "100%" :style {:object-fit "contain"}} |
| 17 | + (io/resource "assets/img/noc-cover.png"))] |
| 18 | + [:div {:class "flex flex-col items-center"} |
| 19 | + [:div {:class "prose dark:prose-invert"} |
| 20 | + [:p |
| 21 | + "This is my ClojureScript implementation of the samples and exercises from " |
| 22 | + [:a {:href "https://natureofcode.com/"} "Nature of Code (2nd Edition)"] " by Daniel Shiffman."] |
| 23 | + [:p |
| 24 | + "The book will be released in July 2024. It is available online for free, but the pre-order for the hardback and ebook editions are open now. " |
| 25 | + [:a {:href "https://natureofcode.com/"} "Go check it out!"]] |
| 26 | + [:p "You can find the source code for this document and my Clojure sketches at " [:a {:href "https://github.com/Ramblurr/nature-of-code"} "https://github.com/Ramblurr/nature-of-code"]]]]]) |
| 27 | + |
| 28 | +(clerk-ext/admonition "This project is a work in progress and isn't yet finished. I add to it when I find the time, which may not be often." :style :warning) |
| 29 | + |
| 30 | +;; ### Why? |
| 31 | + |
| 32 | +;; I've been a fan of Daniel Shiffman's work (the 1st edition of Nature of Code, |
| 33 | +;; as well as their excellent [Coding Train](https://thecodingtrain.com/)) for a |
| 34 | +;; long time. I've always wanted to work through the book. When I learned that they were releasing a new edition, I figured now was the time. |
| 35 | + |
| 36 | +;; Implementing the examples and exercises in Clojure is a great way to move |
| 37 | +;; through the material to ensure I understand it. |
| 38 | + |
| 39 | +;; ### How? |
| 40 | + |
| 41 | +;; Though I've tried to keep the code as close to the original as possible, |
| 42 | +;; Clojure is an immutable functional programming language, and my translation |
| 43 | +;; of the examples adhere to that property. |
| 44 | + |
| 45 | +(clerk/html |
| 46 | + [:p "To learn how I've structured the code to avoid willy-nilly mutation or what tech I'm using to render all of this, check out the " |
| 47 | + [:a {:href (clerk/doc-url "notebooks/background")} "background"] "."]) |
| 48 | + |
| 49 | +;; ## Table of Contents |
| 50 | + |
| 51 | +(clerk/html |
| 52 | + (into |
| 53 | + [:div.md:grid.md:gap-8.md:grid-cols-2.pb-8] |
| 54 | + (map |
| 55 | + (fn [{:keys [path preview title description]}] |
| 56 | + [:a.rounded-lg.shadow-lg.border.border-gray-300.relative.flex.flex-col.hover:border-indigo-600.group.mb-8.md:mb-0 |
| 57 | + {:href (clerk/doc-url path) :title path :style {:height 300}} |
| 58 | + [:div.flex-auto.overflow-hidden.rounded-t-md.flex.items-center.px-3.py-4 |
| 59 | + (when preview |
| 60 | + (noc.render/image-ext {:width "100%" :style {:object-fit "contain"}} |
| 61 | + preview))] |
| 62 | + [:div.sans-serif.border-t.border-gray-300.px-4.py-2.group-hover:border-indigo-600 |
| 63 | + [:div.font-bold.block.group-hover:text-indigo-600 title] |
| 64 | + [:div.text-xs.text-gray-500.group-hover:text-indigo-600.leading-normal description]]]) |
| 65 | + [{:title "Chapter 0" |
| 66 | + :preview (io/resource "assets/img/chapter0.png") |
| 67 | + :path "notebooks/chapter_0" |
| 68 | + :description "Randomness"}]))) |
0 commit comments