9

Core.match available for self hosted ClojureScript (Planck and Klipse)

 3 years ago
source link: https://blog.klipse.tech/clojure/2020/09/16/core-match-abbinare.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.
neoserver,ios ssh client

Core.match available for self hosted ClojureScript (Planck and Klipse)

Sep 16, 2020 • Yehonathan Sharvit

core.match - A pattern matching library for Clojure[script] - is available for self-hosted ClojureScript. It means that it can run in Planck and Klipse.

The code is available as a fork of core.match called abbinare.

The approach is similar to what Mike Fikes did for core.async with andare.

Both names comes from italian: “andare” means “go” and “abbinare” means match (in the sense of combine).

match

In order to use core.match in Klipse, simply require it and Klipse will fetch abbinare code from its analysis cache repository:

xxxxxxxxxx
(require '[cljs.core.match :refer-macros [match]])
the evaluation will appear here (soon)...

In order to use core.match in Planck, add abbinare as a dependency with:

 [viebel/abbinare "1.10.597"]

Here is a quick demo - running in your browser - of a solution to the famous Fizz buzz interview question with core.match:

xxxxxxxxxx
(with-out-str (doseq [n (range 1 11)]
                (println
                 (match [(mod n 3) (mod n 5)]
                        [0 0] "FizzBuzz"
                        [0 _] "Fizz"
                        [_ 0] "Buzz"
                        :else n))))
xxxxxxxxxx
the evaluation will appear here (soon)...

Want more core.match cool stuff in your browser? Read this core.match interactive tutorial.

If you enjoy this kind of interactive articles would you consider a (small) donation💸 on Patreon or at least giving a star⭐ for the Klispe repo on Github?

to stay up-to-date with the coolest interactive articles around the world.

Discover more cool interactive articles about javascript, clojure[script], python, ruby, scheme, c++ and even brainfuck!

Give Klipse a Github star to express how much you appreciate Code Interactivity.

Subscribe to the Klipse newsletter:

Feel free to email me [email protected] for getting practical tips and tricks in writing your first interactive blog post.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK