Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Load a File in the Leiningen REPL

Leiningen allows us to load a file right in the REPL, with (load-file name):

user=> (load-file "guess_the_number_with_feedback.clj")

This returns the name of the last function defined, which is useful, because that’s likely to be our main function or equivalent (which we would then call).

Here is the documentation, also from the REPL:

user=> (doc load-file)
  Sequentially read and evaluate the set of forms contained in the file.