{"id":16726459,"url":"https://github.com/viebel/klipse-repl","last_synced_at":"2025-03-17T01:31:31.500Z","repository":{"id":62433225,"uuid":"150699177","full_name":"viebel/klipse-repl","owner":"viebel","description":"Beginners friendly Clojure REPL","archived":false,"fork":false,"pushed_at":"2019-05-30T11:58:21.000Z","size":47,"stargazers_count":44,"open_issues_count":6,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T21:22:07.622Z","etag":null,"topics":["beginner-friendly","clojure","interactive","repl"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viebel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-28T07:01:41.000Z","updated_at":"2022-08-06T23:22:25.000Z","dependencies_parsed_at":"2022-11-01T21:15:31.777Z","dependency_job_id":null,"html_url":"https://github.com/viebel/klipse-repl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viebel%2Fklipse-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viebel%2Fklipse-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viebel%2Fklipse-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viebel%2Fklipse-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viebel","download_url":"https://codeload.github.com/viebel/klipse-repl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243836015,"owners_count":20355615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner-friendly","clojure","interactive","repl"],"created_at":"2024-10-12T22:53:15.959Z","updated_at":"2025-03-17T01:31:31.112Z","avatar_url":"https://github.com/viebel.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Clojars Project](https://img.shields.io/clojars/v/viebel/klipse-repl.svg)](https://clojars.org/viebel/klipse-repl)\n\n# Rationale\n\nProvide a REPL that is super-friendly to beginners without bothering them with details that are hard to grasp when you are a Clojure beginner. The motivation for beginner friendly REPL was born during the writing of the book [Get Programming with Clojure](https://www.getprogrammingwithclojure.com/).\n\nFor instance,\n\n1. `def` forms return the value of the var instead of the var itself\n2. `defn` forms return a message saying that a function has been created instead of returning the var of the function created\n\n\n\n# How to install\n\nIf you want to try the Klipse REPL really quickly, [install the Clojure CLI tools](https://clojure.org/guides/getting_started)\nand then invoke this:\n\n```shell\nclojure -Sdeps \"{:deps {viebel/klipse-repl {:mvn/version \\\"0.2.3\\\"}}}\" -m klipse-repl.main\n```\n\nThat should start the Klipse REPL and displays a welcome message like this one:\n\n```shell\nWelcome to Klipse REPL (Read-Eval-Print Loop)\nClojure 1.10.0-beta3\nuser=\u003e\n```\n\nNote that I am using the `clojure` command and not the `clj` command because the latter wraps the process with another readline program (rlwrap) which is not necessary because the history is handled by the Klipse REPL itself.\n\nIf you happen to like it, you will probably find it more convenient to specify an alias in your `$HOME/.clojure/deps.edn`\n\n```clojure\n{\n ...\n :aliases {:klipse-repl {:extra-deps {viebel/klipse-repl {:mvn/version \"0.2.3\"}}\n                         :main-opts  [\"-m\" \"klipse-repl.main\"]}}\n}\n```\n\nAnd then run with a simpler:\n\n```shell\n\u003e clojure -A:klipse-repl\nWelcome to Klipse REPL (Read-Eval-Print Loop)\nClojure 1.10.0-beta3\nuser=\u003e\n```\n\nNote that I am using the `clojure` command and not the `clj` command because the latter wraps the process with another readline program (rlwrap) which is not necessary because the history is handled by the Klipse REPL itself.\n\n\n# Features\n\n## Prevents terminal hang on infinite sequences\n\nIt occurs sometimes, that you type in the REPL an expression that generated sequence like `(range)`. In the usual REPL, it will display an infinite sequence of numbers on the screen until you quit the REPL. What a frustration! Now you have to start your REPL session over again.\n\nIn the Klipse REPL, we limit to 1000 the number of items of each collection that are displayed. It prevents the REPL to hang when you evaluate an infinite sequence like `(range)`.\n\nIn case, you need a different limit for the number of items to be displayed, you can pass your number to the command line arguments `--print-length`. For instance, to limit it to 10, you run:\n\n```shell\n\u003e clojure -A:klipse-repl --print-length 10\nWelcome to Klipse REPL (Read-Eval-Print Loop)\nClojure 1.10.0-beta3\nuser=\u003e (range)\n(0 1 2 3 4 5 6 7 8 9 ...)\n```\n\n\n## Gentle message when creating variable and functions\n\nIn a ususal REPL, when you create a `var` or a function, the REPL displays the fully qualified name of the `var` that has been created, for instance `#'user/foo`. This can be a bit confusing for Clojure beginners who have no idea what a namespace is and what is the meaning of the `#'` symbol. In the Klipse REPL, we display a gentle message:\n\n1. `def` forms return the value of the var\n2. `defn` forms return a message displaying the name of the function and the arguments it expects.\n\n~~~clojure\nuser=\u003e (def my-var 42)\n42\nuser=\u003e (defn foo [x] (* 42 x))\nUpdated function foo ([x])\n~~~\n\nThe features of this section can be disabled by the `--no-easy-defs` flag.\n\n## Autocompletion, indentation, coloring etc...\n\nAll of the great features of Bruce Hauman's [rebel-readline](https://github.com/bhauman/rebel-readline) are available in this REPL for the simple reason that this REPL is built on top of [rebel-readline](https://github.com/bhauman/rebel-readline). Some of them are:\n\n1. autocompletion when pressing `TAB`\n2. indentation of multi-line expressions\n3. coloring of forms\n\nSee [rebel-readline](https://github.com/bhauman/rebel-readline) for the full list of features.\n\n## Link to online documentation\n\n[clojuredocs.org](https://clojuredocs.org/) is one of the best resources for Clojure beginers as it provides examples of usage of the Clojure forms. The `doc` macro proviced by Klipse REPL adds a link to the entry of the form in `clojuredocs`. For instance, take a look at the last line of the output of `(doc inc)`:\n\n~~~clojure\nuser=\u003e (doc inc)\n-------------------------\nclojure.core/inc\n([x])\n  Returns a number one greater than num. Does not auto-promote\n  longs, will throw on overflow. See also: inc'\n-------------------------\nOnline doc: https://clojuredocs.org/clojure.core/inc\n~~~\n\n## Live dependency update\n\nIn a usual REPL, when you want to add dependencies, you have to update your `deps.edn` file and restart the REPL. The Klipse REPL supports hot loading of dependencies in two ways:\n\n1. update `deps.edn` and call `(refresh-classpath)` without restarting the REPL.\n2. add dependencies on the fly with `add-deps`.\n\nIn order to enable the features listed in this section, you need to pass the `--cool-forms flag`, like this:\n\n```shell\nclojure -A:klipse-repl --cool-forms\n```\n\n### Refresh the classpath\n\nAdd dependencies in your global or local `deps.edn` and call `(refresh-classpath)` without restarting the REPL.\n\n### Display the classpath\n\nDisplay the classpath as a collection with `(classpath)`.\n\n### Add dependencies on the fly \n\nAdd one or more dependencies on the fly - following `deps.edn` format. Let's say you want to try a cool Clojure library like [cuerdas](https://funcool.github.io/cuerdas/latest/) that provides many string manipulation functions. Instead of modifying your `deps.edn` file and restarting the REPL, you can call `add-deps` inside the Klipse REPL, just like this:\n\n\n~~~clojure\nuser=\u003e (add-deps '{funcool/cuerdas {:mvn/version \"2.0.5\"}})\nnil\nuser=\u003e (require '[cuerdas.core :as str])\nnil\nuser=\u003e (str/strip-tags \"\u003cp\u003ejust \u003cb\u003esome\u003c/b\u003e text\u003c/p\u003e\")\n\"just some text\"\n~~~\n\n## Remote connection\n\nYou can launch the REPL as a socket REPL server and connect with it remotely\n\n```shell\n$ clojure -A:klipse-repl --port 9876\nlaunching socket repl on port 9876\nWelcome to Klipse REPL (Read-Eval-Print Loop)\nClojure 1.9.0\nuser=\u003e (def a 1)\n1\n```\n\nAnd then from another terminal, you connect with `nc` or `telnet`:\n\n~~~bash\n$ nc localhost 9876\nWelcome to Klipse REPL (Read-Eval-Print Loop)\nClojure 1.9.0\nuser=\u003e a\n1\n~~~\n\nBe aware that the state of the REPL is shared between the host and all its remote connections.\n\n\n# Credits\n\nThis REPL runs on top of the awesome [rebel-readline](https://github.com/bhauman/rebel-readline) by Bruce Hauman.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviebel%2Fklipse-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviebel%2Fklipse-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviebel%2Fklipse-repl/lists"}