liveBook · Manning

Entry point

As explained in Clojure: The Essential Reference

A main method is a Java entry-point method that Java launchers invoke to start an application.

An entry point starts a Clojure application. The clojure.main namespace provides the main function, which parses command-line parameters and selects a program to execute; when no program is specified, it starts the REPL. section 22.0 section 22.4

Use clojure.main around two practical startup operations:

  • Load and evaluate a Clojure file with load-script, using either a classpath path or a filesystem path. section 22.4
  • Start or customize a REPL with repl, including initialization, prompts, input reading, and evaluation behavior. section 22.4

A customized REPL as an application

A calculator can define plus, minus, times, and divide, then start a REPL whose :init option makes those functions immediately available. Additional options can change the prompt, input reader, and evaluator. section 22.4

How Clojure: The Essential Reference covers it

How deep it goes
Defines main’s startup role and briefly describes load-script and repl, without detailing launcher invocation.
Examples
Demonstrates script loading and customized calculator REPLs with initialization, prompts, input parsing, and evaluation.
What you can do after
Operate/configure Clojure startup by loading scripts or launching a customized REPL through clojure.main.
How it connects
Connects command-line parameters with the REPL, load-script, and repl customization.

Also explained in

Compare how 10 books explain entry point →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.