Skip to content

Commit

Permalink
intro: update link and page references
Browse files Browse the repository at this point in the history
  • Loading branch information
practicalli-johnny committed Mar 8, 2024
1 parent 91b2e41 commit fec7be9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
6 changes: 3 additions & 3 deletions docs/introduction/learning-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Practice writing and evaluating Clojure code using [:fontawesome-solid-book-open

Take a quick look at the Syntax of Clojure. The syntax is very small, so this will take about 15 minutes to 1 hour (dependent on your own experiences with coding). Don't try to remember all the syntax and functions, they will come through practise.

- eg. [:fontawesome-solid-book-open: Clojure in 15 minutes](clojure-in-15-minutes.md)
- eg. [:fontawesome-solid-book-open: Clojure in 15 minutes](./clojure-in-15-minutes.md)


## REPL Connected Editor
Expand Down Expand Up @@ -62,9 +62,9 @@ Gain an appreciation that a software system should strive for a simple design is

Spend an hour watching the author of the Clojure Language, [:globe_with_meridians: Rich Hickey, talk about Simple made Easy](https://www.infoq.com/presentations/Simple-Made-Easy) or read the ([:globe_with_meridians: transcript of talk](https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/SimpleMadeEasy.md)) to emerse in the foundational concepts of Clojure.

Review the [:fontawesome-solid-book-open: Clojure Big Ideas](concepts/) presented by Stuart Halloway and further [:fontawesome-solid-book-open: video presentations by Rich Hickey](concepts/clojure-from-the-author.md){target=_blank .mkdocs-button}.
Review the [:fontawesome-solid-book-open: Clojure Big Ideas](./concepts/) presented by Stuart Halloway and further [:fontawesome-solid-book-open: video presentations by Rich Hickey](./concepts/clojure-from-the-author.md){target=_blank .mkdocs-button}.

[:fontawesome-solid-book-open: Rich Hickey video lecture series](concepts/clojure-from-the-author.md){target=_blank .mkdocs-button}
[:fontawesome-solid-book-open: Rich Hickey video lecture series](./concepts/clojure-from-the-author.md){target=_blank .mkdocs-button}


## Practice Practice Practice
Expand Down
62 changes: 33 additions & 29 deletions docs/introduction/repl-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,23 @@ Expressions in rich comment blocks can represent how to use the functions that m
) ; End of rich comment block
```

Rich comment blocks are very useful for rapidly iterating over different design decisions by including the same function but with different implementations. Hide [clj-kondo linter](https://practical.li/clojure/clojure-cli/install/code-analysis.html){target=_blank} warnings for redefined vars (`def`, `defn`) when using this approach.
Rich comment blocks are very useful for rapidly iterating over different design decisions by including the same function but with different implementations.

```clojure
;; Rich comment block with redefined vars ignored
#_{:clj-kondo/ignore [:redefined-var]}
(comment
(defn value-added-tax []
;; algorithm design - first idea)
Hide [clj-kondo linter](https://practical.li/clojure/reference/code-analysis/){target=_blank} warnings for redefined vars (`def`, `defn`) when using this approach.

(defn value-added-tax []
;; algorithm design - second idea)
!!! EXAMPLE ""
```clojure
;; Rich comment block with redefined vars ignored
#_{:clj-kondo/ignore [:redefined-var]}
(comment
(defn value-added-tax []
;; algorithm design - first idea)

(defn value-added-tax []
;; algorithm design - second idea)

) ;; End of rich comment block
```
) ;; End of rich comment block
```

The "Rich" in the name is an honourary mention to Rich Hickey, the author and benevolent dictator of Clojure design.

Expand Down Expand Up @@ -113,15 +116,15 @@ Pretty print shows the structure of results from function calls in a human-frien
Tools to view and navigate code

* [:fontawesome-solid-book-open: Cider inspector](https://practical.li/spacemacs/evaluating-clojure/inspect/){target=_blank} is an effective way to navigate nested data and page through large data sets.
* [:fontawesome-solid-book-open: Portal Inspector](https://practical.li/clojure/clojure-tools/data-inspector/portal){target=_blank} to visualise many kinds of data in many different forms.
* [:fontawesome-solid-book-open: Portal Inspector](https://practical.li/clojure/data-inspector/portal){target=_blank} to visualise many kinds of data in many different forms.

![Portal - view and navigate Clojure data and event logs](https://raw.githubusercontent.com/practicalli/graphic-design/live/portal/portal-data-browser-example.png)

## Code Style and idiomatic Clojure

Clojure aware editors should automatically apply formatting that follows the [:globe_with_meridians: Clojure Style guide](https://github.com/bbatsov/clojure-style-guide){target=_blank}.

Live linting with [clj-kondo](:fontawesome-brands-github: <https://github.com/borkdude/clj-kondo){target=_blank>} suggests common idioms and highlights a wide range of syntax errors as code is written, minimizing bugs and therefore speeding up the development process.
Live linting with [:fontawesome-brands-github: clj-kondo](https://github.com/borkdude/clj-kondo){target=_blank} suggests common idioms and highlights a wide range of syntax errors as code is written, minimizing bugs and therefore speeding up the development process.

![Clojure code static analysis for live linting](https://raw.githubusercontent.com/practicalli/graphic-design/live/spacemacs/screenshots/spacemacs-clojure-live-linting-flycheck-errors-light.png#only-light)
![Clojure code static analysis for live linting](https://raw.githubusercontent.com/practicalli/graphic-design/live/spacemacs/screenshots/spacemacs-clojure-live-linting-flycheck-errors-dark.png#only-dark)
Expand All @@ -140,22 +143,23 @@ Live linting with [clj-kondo](:fontawesome-brands-github: <https://github.com/bo

As data structures are identified in REPL experiments, create data specification to validate the keys and value types of that data.

```clojure
;; ---------------------------------------------------
;; Address specifications
(spec/def ::house-number string?)
(spec/def ::street string?)
(spec/def ::postal-code string?)
(spec/def ::city string?)
(spec/def ::country string?)
(spec/def ::additional string?)

(spec/def ::address ; Composite data specification
(spec/keys
:req-un [::street ::postal-code ::city ::country]
:opt-un [::house-number ::additional]))
;; ---------------------------------------------------
```
!!! EXAMPLE ""
```clojure
;; ---------------------------------------------------
;; Address specifications
(spec/def ::house-number string?)
(spec/def ::street string?)
(spec/def ::postal-code string?)
(spec/def ::city string?)
(spec/def ::country string?)
(spec/def ::additional string?)

(spec/def ::address ; Composite data specification
(spec/keys
:req-un [::street ::postal-code ::city ::country]
:opt-un [::house-number ::additional]))
;; ---------------------------------------------------
```

As the public API is designed, specifications for each functions arguments are added to validate the correct data is used when calling those functions.

Expand Down

0 comments on commit fec7be9

Please sign in to comment.