- Notifications
You must be signed in to change notification settings - Fork13
inclojure-org/intermediate-clojure-workshop
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Just do the following one by one, and you should be fine.
You will need Java to work with this Clojure workshop content.
First, make sure you have Java 8.
- Run
java -versionin your terminal. - If Java is not installed, pleasedownload and install Java 8 from here.
- Once you are done,
java -versionshould show you a Java 1.8.x version.
Notes:
- If you have Java 9+, that should be OK too.
- The LightTable editor is known to break with Java 9. Use Java 8 if you are keen on using LightTable.
- We have not tested this project with Java 7 and earlier.
FollowLeiningen setup instructions here.
- Clone this project
- Open your terminal, and do the following.
cdinto this project's root directory- Use
lein replcommand to start a REPL with Leiningen. - Wait for it... the REPL will start and print out a message with someuseful information
- Locate the
portandhostinformation in the message. We will need this information soon.
Note:
- Boot should be fine too, but you may need to generate your ownboot file(s).
Set up an editor and figure out how to evaluate Clojure code with it.We are fine with you choosing the editor as long as your editor can do,
- Connect to a Clojure REPL from the editor
- Evaluate snippets and/or entire namespaces in the connected REPL from the editor.
- Code navigation
- Paredit / Parinfer
Editors we can help out with
- Emacs
- Vim
- Cursive
If you don't have an editor setup, we suggest you use Cursive with IntelliJ. Please follow instructions fromhere.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.
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 comesdirectly from the masters, and it can not get more idiomatic (and simpler, really) than this.
Monger uses official Java client for talking with Mongo. This is a standard way of writing database wrappers.Few interesting parts,
- monger.query/exec uses doto to run a bunch of Java methods
- monger.query/exec also uses Protocolsmonger.conversion/ConvertToDBObject andmonger.conversion/ConvertFromDBObject to convert objects at boundary. Monger converts mutable data List/DBList to Clojure vectors.
Carmine is Redis client and is written almost from scratch.
- API is built with amacro
- An atom is used to collecttest results
- Exercise - Can we use core.async here to remove dependency on Thread/sleep?
- It usesIConnectionPool to create different implementations of connection pool
- It uses aedn file to map list of commands Redis supports to Carmine API functions usingdefcommands macro
core.cache is Clojure contrib library. It provides in-memory implementations of different caching strategies
- core.cache/defcache is a macro that reduces repetition of defining a type
- This shows that mutation to cache creates a new value
This one is old, but it really stands out for a few reasons as far as learning goes
- A concise example that shows Java inter-op
- Careful design considerations, and thus what a succinct piece of code within a single namespace can achieve
- Clever use of
metaattributes onvars
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.
Copyright � 2018-2019IN/Clojure.
Distributed under theMIT license.
About
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.