Intro

Replete REPL is a ClojureScript REPL for iOS, macOS, and Android.

Replete REPL launches instantly, providing a full-featured REPL environment that is great for experimenting with and learning the ClojureScript language.

All form evaluation in Replete REPL is done directly in the REPL. (Replete REPL does not delegate to a back-end server for compilation and evaluation.)

REPL

When launched, Replete REPL will enter an interactive Read-Eval-Print Loop, or REPL.

Replete starts off with cljs.user as the current namespace.

In ClojureScript, def and derived forms create vars in the current namespace. In addition, unqualified non-local symbols are resolved to vars in the current namespace.

You can enter forms to be evaluated in the text box. When you tap the "Eval" button (or hit ⌘-Enter on macOS), the form, and any printed output, and the value of the evaluated form will be displayed above the text box.

Try evaluating (+ 1 2) and 3 will be displayed. Or, try (println "Hi") and Hi will be displayed followed by nil (the value of the println call).

You can hit return prior to typing a complete form and the text box will increase in height to accommodate additional input. Multi-line input can continue this way until a full form is entered.

(defn square
  [x]
  (* x x))

When entering forms, closing delimiters will be automatically entered and managed using Parinfer.

History

On Replete REPL iOS or Replete REPL Android, you can copy any previously entered form, output, or result by long pressing on the row containing the item to be copied.

On Replete REPL macOS, ⌘-Up Arrow and ⌘-Down Arrow allow you to move through history.

Result Display

When you evaluate a form, the result is pretty printed using Fipp. This causes output to be wrapped and aligned in a manner that makes it easier to see the structure of the data.

REPL Specials

REPL specials are, in essence, special forms that exist only in the REPL. (They can't be used in regular ClojureScript code and must be entered as top-level forms.)

in-ns

Replete REPL supports in-ns, which will switch you to a new namespace, creating it if it doesn't already exist.

(in-ns 'bar.core)
nil

As in Clojure, Replete REPL's in-ns REPL special accepts any expression, so long as it evaluates to a symbol, so you can do something like this

(def my-ns 'foo.core)
#'cljs.user/my-ns
(in-ns my-ns)
nil

doc, source, pst, apropos, find-doc, dir

Usually in CloureScript, doc is a macro that you refer. In Replete these are REPL specials which are always available, no matter which namespace you are in.

Replete Namespaces

In order to make Replete more useful, some native I/O facilities have been added to the JavaScript engine running in Replete and these have been exposed via a few namespaces. To make things easier to use, the functions in these namespaces adhere fairly closely to existing Clojure / ClojureScript analogs.

The code for these namespaces is are always available—you just need to require them.

These namespaces comprise

To explore these namespaces, you can evaluate (dir replete.core), for example, to see the symbols in replete.core, and then use doc to see the docs for any of the symbols.

Online documentation for the namespaces is available: Replete SDK.

replete.core

(Online docs)

This namespace includes basic I/O capabilities like slurp, spit and read-line. The I/O facilities are expressed in protocols defined in replete.core modeled after those in Clojure, like IReader, IOutputStream, etc., and these capabilities cooperate with facilities defined in replete.io.

Replet core also hosts some dynamic vars of interest like *in* and *out*.

The replete.core/file-seq function imitates clojure.core/file-seq.

The replete.core namespace defines dynamic functions like resolve, ns-resolve, and intern.

replete.io

(Online docs)

This namespace defines a lot of the IOFactory machinery, imitating clojure.java.io.

Additionally, filesystem facilities like file, delete-file, and file-attributes are available.

replete.http

(Online docs)

This namespace provides facilities for interacting with HTTP servers. For example:

(replete.http/get "http://replete-repl.org")

will fetch the main page of the Replete website, returning the status code, headers, and body in a map structure.

Dependencies

Source executed via Replete REPL can depend on other bootstrapped-compatible libraries. To do so, the library must be bundled in Replete. (There is no facility to download dependencies into Replete.)

Bundled Deps

Replete ships with many of the deps that are available to conventional ClojureScript code. In particular this includes most of the Google Closure library as well as these namespaces:

In addition, Replete REPL ships with these libraries:

Contributing

The source for Replete REPL is hosted on GitHub: https://github.com/replete-repl.

If you'd like to contribute, check it out, and take a look at the open issues lists in the repositories.

This documentation is also hosted in the Replete REPL GitHub organization, in the replete-site repository. So, if you find improvements that can be made, feel free to submit PRs!

Legal

Copyright © 2015–2020 Mike Fikes, Roman Liutikov, Jason Jobe, and Contributors

It is distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Replete REPL™ uses several open-source libraries. You can get the details for those libraries by visiting https://github.com/replete-repl