Prepare reproducible example (reprexes) for posting to GitHub issues, StackOverflow, or Slack snippets.
This is a clojure port of the tidyverse/reprex
package for R.
Use the reprex
function to easily capture expressions and their outputs.
With no arguments, reprex will read code from the clipboard:
user=> (require '[reprex.core :refer [reprex]])
nil
user=> (println (reprex))
``` clojure
(+ 1 1)
; => 2
(* 5 5)
; => 25
```
<details><summary>Session info</summary>
```
Clojure version:
1.8.0
Java version:
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
```
</details>
Created by [reprex](https://github.com/Torvaney/reprex-clj)
nil
user=>
Alternatively, you can supply expressions as arguments:
user=> (->> (reprex (+ 1 1) (* 5 5)) println)
This GitHub-flavored Markdown is then ready to be copied and pasted. When rendered, it looks like this:
(+ 1 1)
; => 2
(* 5 5)
; => 25
Session info
Clojure version:
1.8.0
Java version:
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
Created by reprex