$schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true); if(!empty($schemamarkup)) { echo $schemamarkup; }

How to Get Started With Leiningen Clojure App Builds on GNU/Linux

October 12, 2023 | By the+gnu+linux+evangelist.

How to Get Started

  1. 2. Installing Leiningen

    How to Install Leiningen for Clojure on Ubuntu

    Installing Leiningen on Ubuntu
  2. 3. Making Clojure App

    Finalize Leiningen Setup and Get a Clojure Build Hello-World App
    First, make the Target Folder:

    mkdir $HOME/Documents/Clojure && cd $HOME/Documents/Clojure

    And then Create it:

    lein new myapp

    The Command First, Finalize Leiningen Installation and then Create a Skeleton of a simple Clojure App…
    The Core of the App is in the myapp/src/myapp/core.cli File.
    Default content:

    (ns myapp.core)
    (defn foo"I don't do a whole lot."
    [x]
    (println x "Hello, World!"))
    

    Note that the Namespace declaration Matches the Folder Structure.
    Since the core namespace is inside the myapp folder, its name is myapp.core.

  3. 4. Editing Clojure App

    Then Specify a Namespace in the project.cli File to Make a Working App
    Access the Target:

    cd myapp

    And then Edit it:
    (Here for simplicity with the nano Editor, but you can just use Anyone.)

    nano project.cli

    For example, we could Set the foo Function from the myapp.core namespace as the Entry Point for the application Using the :main Key like:

    (defproject myapp "0.1.0-SNAPSHOT"
    :description "FIXME: write description"
    :url "http://example.com/FIXME"
    :license {:name "Eclipse Public License"
    :url "http://www.eclipse.org/legal/epl-v10.html"}
    :dependencies [[org.clojure/clojure "1.6.0"]]
    ;;this will set foo as the main function
    :main myapp.core/foo)
    

    Ctrl+x to Save & Exit from nano Editor :)

  4. 5. Running Clojure App

    The you can Run the Clojure Hello-World App
    With:

    lein run Happy

    That will Return as Output:

    Happy Hello, World!

    Troubleshooting Leiningen/Clojure Error loading project.cli

    Solve error loading project.cli

Contents