|
1 | 1 | # Clojure intermediate workshop
|
2 | 2 |
|
3 |
| -# Setup Instructions |
| 3 | +## Setup instructions |
4 | 4 |
|
5 |
| -Just do the following one by one, and you should be fine. |
| 5 | +### Java 11 |
| 6 | +You will need java to work with this workshop content. |
6 | 7 |
|
7 |
| -## Java 8 |
| 8 | +First check if you have Java 11. You can do this by running the following command: |
| 9 | +`java -version` |
8 | 10 |
|
9 |
| -You will need Java to work with this Clojure workshop content. |
| 11 | +If Java is not installed please register at this link and download it for free from the following link. |
| 12 | +https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html |
10 | 13 |
|
11 |
| -First, make sure you have Java 8. |
| 14 | +You can verify that java has been installed properly by running the following command |
| 15 | +`java -version` |
12 | 16 |
|
13 |
| - - Run `java -version` in your terminal. |
14 |
| - - If Java is not installed, please [download and install Java 8 from here](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). |
15 |
| - - Once you are done, `java -version` should show you a Java 1.8.x version. |
| 17 | +We have not tested this project with Java versions other than Java 11 hence it is highly recommended |
| 18 | +that you have this one installed |
16 | 19 |
|
17 |
| -Notes: |
| 20 | +### Leiningen |
| 21 | +Follow Leiningen setup instructions mentioned here: https://leiningen.org/ |
18 | 22 |
|
19 |
| - - If you have Java 9+, that should be OK too. |
20 |
| - - The LightTable editor is known to break with Java 9. Use Java 8 if you are keen on using LightTable. |
21 |
| - - We have not tested this project with Java 7 and earlier. |
| 23 | +Fire up a REPL by running the following command `lein repl`. This should give you a repl |
| 24 | +prompt. Enter `(+ 1 2)` and press enter. You should get back `3` as the result. |
22 | 25 |
|
| 26 | +Additionally run `lein --version` to ensure that the correct version of lein has been installed. |
23 | 27 |
|
24 |
| -## Leiningen |
| 28 | +This project is tested with Leiningen 2.9.1. It is highly recommended that you use the same version. |
25 | 29 |
|
26 |
| -Follow [Leiningen setup instructions here](https://leiningen.org/). |
| 30 | +**WARNING** This project will break with Leiningen 3.0.0 or higher |
27 | 31 |
|
28 |
| -### Fire up a REPL |
| 32 | +### Intellij |
29 | 33 |
|
30 |
| - - Clone this project |
31 |
| - - Open your terminal, and do the following. |
32 |
| - - `cd` into this project's root directory |
33 |
| - - Use `lein repl` command to start a REPL with Leiningen. |
34 |
| - - Wait for it... the REPL will start and print out a message with some |
35 |
| - useful information |
36 |
| - - Locate the `port` and `host` information in the message. We will need this information soon. |
| 34 | +You can download Intellij by following the instructions here: https://www.jetbrains.com/idea/download/index.html |
37 | 35 |
|
38 |
| -Note: |
| 36 | +You are free to use the editor of your choice as long as you can do the following with it: |
39 | 37 |
|
40 |
| - - [Boot](http://boot-clj.com/) should be fine too, but you may need to generate your own _boot_ file(s). |
| 38 | +* Jump to definition for Clojure or Java sources |
| 39 | +* Start or connect to a REPL |
| 40 | +* Structural editing with paredit / parinfer |
41 | 41 |
|
42 | 42 |
|
43 |
| -## Code Editor and Tooling |
| 43 | +We will be using Intellij + Cursive for this workshop hence it is highly recommended that you have it installed. For Intellij, |
| 44 | +we recommend version 2019.3.2 or later. |
44 | 45 |
|
45 |
| -Set up an editor and figure out how to evaluate Clojure code with it. |
46 |
| -We are fine with you choosing the editor as long as your editor can do, |
47 | 46 |
|
48 |
| - - Connect to a Clojure REPL from the editor |
49 |
| - - Evaluate snippets and/or entire namespaces in the connected REPL from the editor. |
50 |
| - - Code navigation |
51 |
| - - Paredit / Parinfer |
| 47 | +### Cursive |
52 | 48 |
|
53 |
| -Editors we can help out with |
54 |
| - - Emacs |
55 |
| - - Vim |
56 |
| - - Cursive |
| 49 | +You can get started with Cursive by following the instructions here: https://cursive-ide.com/userguide/ |
57 | 50 |
|
58 | 51 |
|
59 |
| -### Cursive (IntelliJ) |
| 52 | +### Postman |
| 53 | +You can download Postman by following the instructions here: https://www.postman.com/downloads/ |
60 | 54 |
|
61 |
| -If you don't have an editor setup, we suggest you use Cursive with IntelliJ. Please follow instructions from [here](https://cursive-ide.com/userguide/). |
62 |
| -Do note that you may need to use it in trial mode or get an appropriate license ahead of time. There's a cost-free license available for personal/non-commercial hacking. |
63 |
| - |
64 |
| - |
65 |
| -# Further reading |
66 |
| - |
67 |
| -## Inspiring and insightful source code |
68 |
| - |
69 |
| -### [Clojure Core](https://github.com/clojure/clojure/tree/master/src/clj/clojure) |
70 |
| -This one is not a surprise, but reading sources in the core Clojure library (with the clojure.core namespace being a good starting point) is highly recommended. This one comes _directly_ from the masters, and it can not get more idiomatic (and simpler, really) than this. |
71 |
| - |
72 |
| -### [Monger](https://github.com/michaelklishin/monger) |
73 |
| - |
74 |
| -Monger uses official Java client for talking with Mongo. This is a standard way of writing database wrappers. |
75 |
| -Few interesting parts, |
76 |
| - - [monger.query/exec](https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/query.clj#L87) uses doto to run a bunch of Java methods |
77 |
| - - [monger.query/exec](https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/query.clj#L87) also uses Protocols [monger.conversion/ConvertToDBObject](https://github.com/michaelklishin/monger/blob/6bf528ed5b8a21153e3df1aa0cd1d88e08f31e3a/src/clojure/monger/conversion.clj#L52) and [monger.conversion/ConvertFromDBObject](https://github.com/michaelklishin/monger/blob/6bf528ed5b8a21153e3df1aa0cd1d88e08f31e3a/src/clojure/monger/conversion.clj#L108) to convert objects at boundary. Monger converts mutable data List/DBList to Clojure vectors. |
78 |
| - |
79 |
| -### [Carmine](https://github.com/ptaoussanis/carmine) |
80 |
| -Carmine is Redis client and is written almost from scratch. |
81 |
| - - API is built with a [macro](https://github.com/ptaoussanis/carmine/blob/master/src/taoensso/carmine.clj#L21) |
82 |
| - - An atom is used to collect [test](https://github.com/ptaoussanis/carmine/blob/d00b61afb25426c8ec44f24bf544ae85dc93a4af/test/taoensso/carmine/tests/main.clj#L249) results |
83 |
| - - Exercise - Can we use core.async here to remove dependency on Thread/sleep? |
84 |
| - - It uses [IConnectionPool](https://github.com/ptaoussanis/carmine/blob/d00b61afb25426c8ec44f24bf544ae85dc93a4af/src/taoensso/carmine/connections.clj#L42) to create different implementations of connection pool |
85 |
| - - It uses a [edn file](https://github.com/ptaoussanis/carmine/blob/7d0e6f054a42473af4c513869491b752567f3cec/src/commands.edn) to map list of commands Redis supports to Carmine API functions using [defcommands macro](https://github.com/ptaoussanis/carmine/blob/d00b61afb25426c8ec44f24bf544ae85dc93a4af/src/taoensso/carmine/commands.clj#L275) |
86 |
| - |
87 |
| -### [core.cache](https://github.com/clojure/core.cache) |
88 |
| -core.cache is Clojure contrib library. It provides in-memory implementations of different caching strategies |
89 |
| - - [core.cache/defcache](https://github.com/clojure/core.cache/blob/master/src/main/clojure/clojure/core/cache.clj#L67) is a macro that reduces repetition of defining a type |
90 |
| - - [This](https://github.com/clojure/core.cache/blob/master/src/main/clojure/clojure/core/cache.clj#L224) shows that mutation to cache creates a new value |
91 |
| - |
92 |
| -### [clucy](https://github.com/weavejester/clucy/blob/master/src/clucy/core.clj) |
93 |
| -This one is old, but it really stands out for a few reasons as far as learning goes |
94 |
| - - A concise example that shows Java inter-op |
95 |
| - - Careful design considerations, and thus what a succinct piece of code within a single namespace can achieve |
96 |
| - - Clever use of `meta` attributes on `vars` |
97 |
| - |
98 |
| -### [Durable Queue](https://github.com/Factual/durable-queue) |
99 |
| -This one pushes some limits on Clojure-Java interop without descending down into Java (language) land. An instructive piece of source, all within a single namespace. |
100 |
| - |
101 |
| -## Links |
102 |
| - - [Clojure ground up](https://aphyr.com/tags/Clojure-from-the-ground-up)) |
103 |
| - - [Clojure toolbox - list of clojure projects/libraries](https://www.clojure-toolbox.com) |
104 |
| - |
105 |
| -## Copyright and License |
106 |
| - |
107 |
| -Copyright � 2018-2019 [IN/Clojure](https://inclojure.org/). |
108 |
| - |
109 |
| -Distributed under the [MIT license](https://github.com/inclojure-org/clojure-by-example/blob/master/LICENSE). |
| 55 | +The recommended version of Postman is 7.17 or later |
0 commit comments