This is a thing that lets you turn any HTML input field into a Clojure interpreter.
CodePen: https://codepen.io/nichelodean/pen/zYWEgeW
In your html:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"></script>
<div clj-interpreter>
<textarea clj-code></textarea>
<button clj-eval>Evaluate</button>
<pre clj-result></pre>
</div>
clj-interpreter
marks the container div for an interpreter
clj-code
marks the text input that you want to use as the input for the interpreter
clj-eval
designates the button (or any clickable thing) that you want to use to trigger evaluation
clj-result
(optional - results will be window.alert'ed if this is not provided) designates where the result should go
You can do as many of these on a page as you like!
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"></script>
<div clj-interpreter>
<textarea clj-code></textarea>
<button clj-eval>Evaluate</button>
<pre clj-result></pre>
</div>
<div clj-interpreter>
<textarea clj-code></textarea>
<button clj-eval>Evaluate</button>
<pre clj-result></pre>
</div>
<div clj-interpreter>
<textarea clj-code></textarea>
<button clj-eval>Evaluate</button>
<pre clj-result></pre>
</div>
npm install clj-browser-eval
I have no idea what I'm doing and you should not use this for anything real.
Made possible by scittle!