I’ve used Intellij for many years so for me Cursive is the natural choice for a Clojure development environment. A couple of months ago I started working on my first project that involved Clojurescript and while Cursive has great support for Clojurescript it wasn’t totally obvious to me how to connect it to a Figwheel REPL. So this is why I’m sharing a step-by-step guide on how to achieve this. This guide assumes that you have a Leiningen project configured to use Figwheel. This is not hard if you base your project on something like Luminus but you can also read the full `lein-figwheel` documentation here. Here goes:
- Start Figwheel from the terminal (`lein figwheel`) and wait until it says that it has opened an nREPL port (for example `7002`)
- From the menu in Intellij select “Run” -> “Debug…” (or simply press (`alt`+`shift`+`F9`)) and then select “Edit Configurations…”
- Press the
+
button and add a remote Clojure REPL: - Give it a name (it doesn’t matter which), for example “Clojurescript REPL” and instruct it to connect to `localhost` on port `7002`:
- After clicking on “Debug” you should now be connected to the figwheel repl and you can start fiddling around:
- Next we should use the `figwheel-sidecar.repl-api` namespace like this: `(use ‘figwheel-sidecar.repl-api)` and then we need to run the `cljs-repl` function defined in this namespace (`(cljs-repl)`):
It should print roughly the same text that you saw when starting figwheel from the terminal in step 1. And now you’re good to go! You can now for example start evaluating functions defined in your own Clojurescript code that is running in the browser.
Example
Let’s actually try some evaluation now that we’re connected to the REPL. But before we can do this we also need to start our application. From inside Intellij right-click on the Leiningen `project.clj` file and click on “Debug ‘REPL for…'”
Once loaded, start the application from the REPL (if using Luminus you can do `(start)`). Now navigate to the website in your browser (for example `http://localhost:3000`).
Image that we have a clojurescript function like this that we want to evaluate from the figwheel REPL:
(ns my-app)
(defn remove-attr=
"Remove a map from a seq if the seq has a map with a key equal to val."
[key val coll]
(filter (fn [other-val] (not= (key other-val) val)) coll))
To do that go to the REPL window in Intellij that is named “Remote: <namespace>” and change the namespace to `my-app`:
(in-ns 'myapp)
Next let’s try to run the function:
(remove-attr= :name "John" [{:name "John"} {:name "Doe"}])
=> ({:name "Doe"})
Hopefully you got the same output as me!
That’s it!
11 thoughts on “Connect Cursive to Figwheel REPL”
You can submit your site to over 30 different business directories for free with one click https://bit.ly/submityourwebsite
Looking for fast and easy content creation? Try these 3 Amazing AI Tools:
**Create professional videos
**Generate content effortlessly
**Convert text to speech seamlessly
Take your content to the next level today! http://3amazingaitools.top/
Hi Haleby
We would love to talk to you about some sample leads for your company, please come and have a chat with us for Connect Cursive to Figwheel REPL – Coding all the things and get an instant sample of clients..
Generate your own samples!
PCXLeads.com
August
To the haleby.se Administrator
Are you ready to take control of your Google Maps Rankings and boost your business visibility?
Would you like to learn more about our “Google Maps Ranking” service and how it can help you secure a top spot in local search results, attract more customers, and stand out from the competition?
Let us know, and we’ll share all the details with you!
Reply to this email, and I’ll be happy to share more details with you.
Best regards,
Mario Kaestner
Netherlands, GE, Hedel, 5321 Nd, Kweldam 84
To stop any further communication through your website form, Please reply with subject: Unsubscribe haleby.se
SAVE up to 37% on SEO! FREE Onsite SEO + TRANSPARENT link building at COST PRICE with just a 20% fee. Result: Expect a 214% increase in NEW customers on long term! Contact us now at eso.lus@gmail.com
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Hi haleby.se Admin
Are you ready to take control of your Google Maps Rankings and boost your business visibility?
Would you like to learn more about our “Google Maps Ranking” service and how it can help you secure a top spot in local search results, attract more customers, and stand out from the competition?
Let us know, and we’ll share all the details with you!
Reply to this email, and I’ll be happy to share more details with you.
Best regards,
Jaqueline Schubert
Iceland, NA, Reykjavik, 128, Klettsbu? 78
To stop any further communication through your website form, Please reply with subject: Unsubscribe !haleby.se
My name is Ahmet. I’m a bank staff in a Turkish bank. I’ve been looking for someone who has the same nationality as you. A citizen of your country died in the recent earthquake in Turkey, he had in our bank fixed deposit of $11.5 million.
My Bank management is yet to know of his death. If my bank executive finds out about his death ,They would use the funds for themselves and get richer and I would like to prevent that from happening only if I get your cooperation, I knew about it because I was his account manager. Last week my bank management held a meeting for the purpose of a bank audit to note the dormant and abandoned deposit accounts. I know this will happen and that’s why I’m looking for a solution to deal with this situation because if my bank discovers his death, they will divert the funds to the board of directors. I don’t want that to happen.
I request your cooperation to introduce you as the kin/heir of the account as you are of the same nationality as him. There is no risk; the transaction is carried out under a legal agreement that protects you from infringement. I suggest we split the funds, 60/40 and 40 for me. I need this fund for my daughter’s surgery so keep this info confidential. email me so i can provide you with more information. ahmetturkiye1974@outlook.com
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Would you like this New Year to be the year you let go of your hurtful past? Make the resolution to make the change to become your Best Self.
Have you heard of Se-REM? (Self effective – Rapid Eye Movement). Many people don’t know that REM brain activity dramatically improves the processing of traumatic emotion. It creates peace and empowers the listener. Se-REM is an advanced version of EMDR therapy. It is more powerful because it combines elements of 6 different therapies, EMDR, hypnosis, mindfulness, Gestalt child within work, music therapy, and Awe therapy, (connecting profoundly with nature). Classical music alternates between the ears to enhance daydreaming and visualizing in ways you have never experienced. Please read the many reviews that express how much it has helped everyone who has used it.
It has helped thousands of people overcome PTSD, and anxiety. But it is also helpful in a great many situations, any experience that has been traumatic. Se-REM’s mission statement is “Trauma relief at as close to free as possible”. This not-for-profit program downloads to a smart phone or computer and can be used at home.
Read and download at: https://Se-REM.com/ Once you own the program, you are encouraged to give it away to others who will benefit.
https://Se-REM.com/ is in use in 33 countries.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.