Join Arthur Ulfeldt for an in-depth discussion in this video Where's the 'for' loop?, part of Up and Running with Clojure.
- View Offline
- [Voiceover] I'd like to talk for a moment…about a couple of the pitfalls…that can come up when people are first learning Clojure…and looking to apply their existing…thought patterns to the new paradigm.…In Clojure there is a function called for.…For? That sounds very familiar.…Lots of languages have a for loop.…So looking at this code on the left here.…And see, we open a file, define some data,…and then say use a for loop to loop out…through the data and write into a file.…If you go about sort of straight forwardly…translating that into Clojure,…we get a function called output…that takes a file name and some lines.…
It opens the file.…It goes through those lines.…For each line write the line to the file.…Then close the file when you're done.…People will get this and then when they go to run it,…well let's see.…I'm going to go ahead and run the output function,…and I'm going to pass it my data,…which I've defined on the left there to be some lines,…and I would like it to…output to the file name out.txt.…
Alright, let's go ahead and run that.…
Arthur Ulfeldt covers the Leiningen build tool and setting up Clojure to work with the IntelliJ IDEA dev environment. He then reviews the basics of the syntax, including functions, expressions, values, macros, strings, and conditionals. He shows how to structure, compile, and deploy Clojure projects in Leiningen, and pull from Clojure's core library. In the final chapters, Arthur explores references and namespaces and points to resources to learn more about Clojure.
- Installing Leiningen
- Configuring IntelliJ IDEA
- Using REPLs to execute code
- Working with simple and composite values
- Mastering Clojure macros
- Exploring Clojure syntax
- Building a Clojure project with Leiningen
- Mapping, filtering, and reducing
- Binding and destructuring data
- Working with identities