├── deps.edn ├── .vscode └── settings.json ├── .gitpod.dockerfile ├── .gitignore ├── .gitpod.yml ├── src └── mini │ └── hello.clj └── README.md /deps.edn: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "gitpod.enableReleaseNotes": false, 3 | "editor.lightbulb.enabled": false, 4 | "editor.hover.delay": 1300, 5 | } -------------------------------------------------------------------------------- /.gitpod.dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | RUN brew install clojure/tools/clojure 4 | 5 | # rebuilding dockerfile by updating this comment #1 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /.cpcache 9 | /.lein-* 10 | /.nrepl-history 11 | /.nrepl-port 12 | words-alpha.txt 13 | .clj-kondo/.cache/ 14 | .lsp/.cache/ 15 | .lsp/sqlite*.db 16 | .calva/output-window/ 17 | .DS_Store 18 | .portal/ -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.dockerfile 3 | 4 | vscode: 5 | extensions: 6 | - betterthantomorrow.calva 7 | 8 | tasks: 9 | - name: Prepare deps 10 | init: clojure -P -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' 11 | #- name: Open README 12 | # command: open -g README.md 13 | -------------------------------------------------------------------------------- /src/mini/hello.clj: -------------------------------------------------------------------------------- 1 | (ns mini.hello) 2 | 3 | ;; Start by loading this file in the REPL: Ctrl+Alt+C, ENTER 4 | ;; (Alt is labeled `option` or `opt` on many Macs) 5 | 6 | (println "When loading the file, this is printed in the Output/REPL Window") 7 | ;; You can print it again, by evaluating the expression (aka form) 8 | ;; Place the cursor in the expression and press: Alt+ENTER 9 | ;; This is referred to as ”Evaluating a top-level form” 10 | 11 | ;; This function will also be defined 12 | (defn hello [s] 13 | (str "Hello! " s)) 14 | 15 | ;; Call it, and print the result by evaluating this 16 | ;; top-level form (Alt+ENTER, remember?) 17 | (println (hello "When loading the file, this will be printed")) 18 | 19 | ;; You can redefine the `hello` function by editing it, 20 | ;; and with the cursor still inside it, evaluate top-level form. 21 | ;; Then call the function again to see the new result. 22 | 23 | 24 | ;; This is a so called Rich Comment, nothing in it will be evaluated 25 | ;; when you load the file 26 | (comment 27 | (println (hello "This will NOT be be printed when you load the file")) 28 | ;; You can print it by evaluating it as a top-level form 29 | 30 | ;; This call (evaluate top-level form) will give an error 31 | (println (hello2 "The function hello2 is not defined by the file load")) 32 | 33 | ;; Evaluate this top-level form, and then try the above call again 34 | (defn hello2 [s] 35 | (str "Hello again! " s)) 36 | 37 | ;; There is also a command for evaluating the Current Form: Ctrl+ENTER 38 | ;; Try it at some different places in the below expression 39 | (println 40 | (str 0 1 "foo" 41 | :bar [1 2 3] 42 | (inc 41))) 43 | ) 44 | 45 | ;; Now you know the most important things about Calva, enough to follow 46 | ;; along what is happening in this video: https://www.youtube.com/watch?v=d0K1oaFGvuQ 47 | ;; (Clojure Workflow with Calva coding FizzBuzz) 48 | 49 | ;; To learn more about Calva, and some basics about Clojure, use the command: 50 | ;; **Calva: Fire up the Getting Started REPL** 51 | ;; Please visit https://calva.io for Calva documentation 52 | 53 | (println (hello "This will also be be printed when you load the file")) 54 | 55 | "When loading the file in the REPL, this string will be the result" 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Clojure Get Started Mini(mal) Project 2 | 3 | This is a mini(mal) [Clojure](https://clojure.org) project that you can start hacking from. The instructions are for using [Calva](https:/calva.io), a Clojure IDE for Visual Studio Code. You can use it both in VS Code on your machine or directly in the browser, with full editor tooling. 4 | 5 | NB: This is not a meant as *Your First Clojure App* project. It is meant as an easy way to take Clojure for a spin in the development environment it is designed to be used: *the Editor*. 6 | 7 | Use this project to learn just enough about how a Clojure program is developed, and to check if Clojure might be for you. Then head to the [Where to go Next?](#where-to-go-next) section below for pointers on how you might continue your Clojure journey. 8 | 9 | ## Usage 10 | 11 | Depending wether you will use this in the web browser or on your computer the initial steps differ: 12 | 13 |
In the browser |
21 | On your machine |
22 |
| 27 | 28 | When used in the browser all you need is a Github account, that's all. 29 | 30 | [](https://gitpod.io/#https://github.com/PEZ/minimal-clojure) 31 | 32 | You will be prompted to log in, choose to use Github login. 33 | 34 | This will open the repository in a Gitpod workspace in the browser. (Might take a while.) You'll find VS Code and Calva running there, ready to let you edit the files in the project. 35 | | 36 |37 | When used on your own machine you will need: 38 | 39 | 1. Have Java installed (procedure will vary with platform and your preferences) 40 | 1. Have [Visual Studio Code](https://code.visualstudio.com/) installed 41 | 1. Install Calva from VS Code's Extension pane. 42 | 1. A copy of this repository 43 | 1. Fork it or make a hard copy 44 | 1. Clone your copy to your computer 45 | 1. Open the project folder in VS Code 46 | | 47 |