Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Easier Getting Started with Clojure  RSS feed

 
Rancher
Posts: 351
20
Clojure Linux Mac OS X Monad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been a bit quiet in here lately so I thought I would drop some news about an easier process to get started with Clojure!

For a while now, the Clojure/core team at Cognitect have been working on improving the "entry" process for using Clojure. In the past, you either downloaded the JAR and ran that directly at the terminal -- which was a very bare bones experience -- or you installed one of the Clojure build tools (Leiningen or Boot) in order to get a REPL up and running, or run your program or your tests. Recently, a new command-line tool has been made available and the Getting Started section on Clojure's web site has been updated.

If you're on a Mac, it's as simple as brew install clojure which will install both a basic clojure command and a more friendly clj command (that uses rlwrap around clojure to provide history and editing at the terminal).

If you're on Linux, you can use curl to download an installation script but packaged versions are coming (for apt-get etc).

If you're on Windows, a PowerShell installer is in the works (but, hey, if you're on Windows 10, you can install Ubuntu etc via Windows Subsystem for Linux and use the Linux installer script -- and that works just fine).

The new command line tool starts a REPL by default but can also fetch library dependencies and add them to the classpath. It can also run your code, providing options to specify the "main" function and arguments to that, as well as JVM options.

Dependencies are specified in a file called deps.edn (EDN is an enhanced form of JSON). You can specify libraries on Maven Central or Clojars (the Clojure community's Maven-compatible repository -- for arbitrary Clojure projects). You can also specify dependencies as Git coordinates (a URL to the source code repository and the SHA to identify the commit to use) or on the local file system (so you can manage multiple projects locally that depend on each other).

The command line tools introduce the concept of aliases (somewhat borrowed from Leiningen) that let you layer and combine dependencies and options in ways that are very powerful. Here's my .clojure/deps.edn file with several useful aliases for running tests, benchmarking, measuring memory usage, starting various types of REPL, choosing which version of Clojure to use etc.
 
Sean Corfield
Rancher
Posts: 351
20
Clojure Linux Mac OS X Monad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An alpha of the PowerShell installer for Windows is now available: https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!