4

thegeez blog - crepl: Run continuously

 3 years ago
source link: http://thegeez.net/2017/02/05/crepl_run_continuously.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

crepl: Run continuously

05 Feb 2017

With crepl you can write and run ClojureScript code together. Everybody always sees the same code, because all the changes are updated in everyones browser simultaneously. However, everybody can only run the code in their own browser. This is why the output of "Evaluate expression" is inserted in the code. This way everybody is guaranteed to see the same output.

(+ 3 4
   (do (println "Some output")
     5))
(comment ;; eval'd by Guest 83477 =>
  12
;; [println] Some output
  )

With the output in the code you can always make sure everybody is looking at the same thing, particularly in case the code is not deterministic. But all this output in the code can be annoying and create a bit of a mess. (You can quickly delete it with Ctrl+d.)

The l in crepl

crepl stands for collaborative read eval print loop. So the l stands for loop. To loop you can click "Evaluate expression" or Ctrl+Enter again and again and again. But sometimes it is more convenient if the looping is done automatically. So now crepl supports running continuously.

crepl_run_cont.png

Running continuously with an output panel and the console log panel.

The output in the UI panel and the console log is not send to everybody that is looking at the same code. But if the code is deterministic, everybody will see the same output. To share what you are seeing with others, you can still use "Evaluate expression".

Try crepl here: crepl.thegeez.net


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK