TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Try Clojure – An interactive tutorial in the browser

277 pointsby silcoonabout 3 years ago

24 comments

Jeayeabout 3 years ago
For the site author, thanks for this tool! Clojure has changed the way I program and I&#x27;ve been using it for 6 years now. Anything to help more people get into Clojure is much appreciated, especially if it&#x27;s REPL-oriented.<p>For some feedback, you might consider using Let&#x27;s Encrypt for setting up free TLS certs, or hosting on Github Pages to get it automatically. With just HTTP, my browser (and many others) will show a scary warning telling me not to use the site.
评论 #30424639 未加载
jettiabout 3 years ago
I have been using Clojure professionally for the last 2.5 years, after doing 9 years of C#, and really enjoy it. I recently got a Windows laptop and was interested in ClojureCLR. It has a ways to go in terms of coming close to tooling of JVM and ClojureScript. David Miller has done an amazing job at keeping the project going and I hope I can give back to that community
klavikabout 3 years ago
Awesome job. I have also made another Clojure interactive tutorial which is more advanced, even showcases how to use React with ClojureScript. It is available in <a href="https:&#x2F;&#x2F;orgpad.com&#x2F;s&#x2F;clojure-tutorial" rel="nofollow">https:&#x2F;&#x2F;orgpad.com&#x2F;s&#x2F;clojure-tutorial</a> and I have made a video about it in <a href="https:&#x2F;&#x2F;youtu.be&#x2F;lJxvKNjRdu8" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;lJxvKNjRdu8</a>.
评论 #30436002 未加载
tharneabout 3 years ago
For those interested in Clojure in general, the Clojurians Slack is an amazing resource. Great community, and extremely helpful to folks getting started.<p><a href="https:&#x2F;&#x2F;clojurians.slack.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;clojurians.slack.com&#x2F;</a>
评论 #30436231 未加载
gengstrandabout 3 years ago
I started playing around with Clojure back in 2014 by implementing a rudimentary polyglot persistent news feed microservice. That microservice used Ring which sits on top of Jetty. I blogged about that implementation at <a href="https:&#x2F;&#x2F;glennengstrand.info&#x2F;software&#x2F;architecture&#x2F;oss&#x2F;clojure" rel="nofollow">https:&#x2F;&#x2F;glennengstrand.info&#x2F;software&#x2F;architecture&#x2F;oss&#x2F;clojur...</a> which is my personal blog. Last year, I re-evaluated Clojure with a feature identical microservice. This time, I integrated with Donkey which sits on top of Vert.x and <a href="https:&#x2F;&#x2F;glennengstrand.info&#x2F;software&#x2F;architecture&#x2F;microservice&#x2F;clojure&#x2F;vertx" rel="nofollow">https:&#x2F;&#x2F;glennengstrand.info&#x2F;software&#x2F;architecture&#x2F;microservi...</a> is where I blogged about that implementation.<p>I put each of these implementations in a load test lab where I collect then analyze the performance data for comparison purposes. Those two blogs include the performance results. It is hard for Clojure to compete with other tech stacks, primarily because each method call in Clojure goes through Java reflection which is pretty slow. There is a way to prevent the use of Java reflection in Clojure but then the Clojure code doesn&#x27;t end up looking very Lisp like. The usual advise is to use type hints very sparingly like in hot spots in the code.<p>I still like Clojure, though.
评论 #30424580 未加载
评论 #30425879 未加载
评论 #30424713 未加载
评论 #30426096 未加载
maicroabout 3 years ago
Not sure I &quot;get&quot; Clojure yet, but I appreciate the effort and will poke at it further.<p>One piece of feedback - &quot;Range of N&quot; should clarify that &quot;range&quot; is generating N numbers starting at 0, so N won&#x27;t actually be included (&quot;0 to N exclusive&quot;). I know this is fairly common for most programming languages, but &quot;So (range 5) will return numbers from 0 to 5.&quot; is still ambiguous enough that I think it should be clarified.<p>Also can&#x27;t copy the text from the instructions or REPL (at least in Vivaldi on Windows 10).<p>edit: I&#x27;m not a huge fan of the &quot;multiples of 11&quot; algorithm (&quot;100&quot; and &quot;11&quot; never actually show up in the expression...), so I ended up with this abomination which I think strongly reiterates that I don&#x27;t get Clojure yet...:<p>&gt; (let [multiplier 11 limit 100] (map (fn [n] (if (&gt; limit (* n multiplier)) (* n multiplier))) (range 1 (&#x2F; limit multiplier))))<p>(11 22 33 44 55 66 77 88 99)<p>The conditional is probably not needed, but I was curious how they worked... Also glad that range accepts a float for the second value, as I forgot to wrap that in &quot;int&quot; (and &quot;Math&#x2F;round&quot; didn&#x27;t seem to work). And yeah, tested and this works just as well for at least the basic version:<p>&gt; (let [multiplier 11 limit 100] (map (fn [n] (* n multiplier)) (range 1 (&#x2F; limit multiplier))))
评论 #30428568 未加载
buzzwordsabout 3 years ago
I would love to work with clojure. I thought there were opportunities for to work on a clojure project in my previous company. But I was told that no one likes to work on these products hence why they moving away from clojure and rewriting everything in java or scala. I wish I could tell you exactly why they hated it, I never got an answer. Speaking to some of the individuals, they thought it came down to tooling, no career benefits and some people really missed types.
评论 #30425138 未加载
评论 #30425145 未加载
drikerfabout 3 years ago
Thanks for making this. Hope it helps people discover the joy of Clojure :)!<p>I&#x27;ve built my SaaS in Clojure and ClojureScript and really enjoy working with it every day since 2019!
shivekkhuranaabout 3 years ago
slightly offtopic: My company (Meta Blocks), and my last company (Status) are hiring for Clojure roles. Please reach out to me if you are considering a switch.
评论 #30425838 未加载
geokonabout 3 years ago
I was always wondering why something like this doesn&#x27;t exist already! This is really great.<p>Would it be possible to add `add-libs` from `tools.deps.alpha`? <a href="https:&#x2F;&#x2F;insideclojure.org&#x2F;2018&#x2F;05&#x2F;04&#x2F;add-lib&#x2F;" rel="nofollow">https:&#x2F;&#x2F;insideclojure.org&#x2F;2018&#x2F;05&#x2F;04&#x2F;add-lib&#x2F;</a> Then you could add libraries at runtime directly from the REPL<p>You could then pair it with a pastbin and share&#x2F;run code snippets (with some URL shortener). Could you imagine the possibilities for bug reports for instance? :D You could reproducibly demo bugs (well and features as well)
评论 #30426225 未加载
评论 #30426123 未加载
activitypeaabout 3 years ago
Fuming because it wouldn&#x27;t let me continue unless I typed &quot;Hello, world!&quot; without the comma.<p>Jokes (?) aside, great job! I love that the input is an actual `input`, and not a `contenteditable`, big win for accessibility!
simongrayabout 3 years ago
Another interactive tutorial for Clojure: <a href="https:&#x2F;&#x2F;www.maria.cloud&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.maria.cloud&#x2F;</a>
LandRabout 3 years ago
IT&#x27;s worth knowing that this is you typing into a REPL, that when you are actually doign REPL driven development you almost never type directly into the REPL in Clojure.<p>ALmost all editors I&#x27;ve seen allows you to send code to the REPL from your editor, and get the results in line in your editor.<p>Typing into the REPL would be bad practice.
kaliszadabout 3 years ago
My colleague at OrgPad did an interactive Clojure tutorial utilizing Klipse <a href="https:&#x2F;&#x2F;github.com&#x2F;viebel&#x2F;klipse" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;viebel&#x2F;klipse</a> by Yehonathan Sharvit @viebel embedded inside OrgPage cells. The OrgPage can be found here: <a href="https:&#x2F;&#x2F;orgpad.com&#x2F;s&#x2F;iByMMbKLBnq" rel="nofollow">https:&#x2F;&#x2F;orgpad.com&#x2F;s&#x2F;iByMMbKLBnq</a> and here is a commented walk through as a video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lJxvKNjRdu8" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lJxvKNjRdu8</a>
hessammehrabout 3 years ago
<p><pre><code> =&gt;(map inc) function(b){return function(){function c(k,t){t=a.g?a.g(t):a.call(null,t);return b.h?b.h(k,t):b.call(null,k,t)}function d(k){return b.g?b.g(k):b.call(null,k)}function e(){return b.s?b.s():b.call(null)}var f=null,g=function(){function k(w,u,B){var p=null;if(2&lt;arguments.length){p=0;for(var I=Array(arguments.length-2);p&lt;I.length;)I[p]=arguments[p+2],++p;p=new gc(I,0,null)}return t.call(this,w,u,p)}function t(w,u,B){u=hc.i(a,u,B);return b.h?b.h(w,u):b.call(null,w,u)}k.o=2;k.u= function(w){var u=r(w);w=v(w);var B=r(w);w=xe(w);return t(u,B,w)};k.j=t;return k}();f=function(k,t,w){switch(arguments.length){case 0:return e.call(this);case 1:return d.call(this,k);case 2:return c.call(this,k,t);default:var u=null;if(2&lt;arguments.length){u=0;for(var B=Array(arguments.length-2);u&lt;B.length;)B[u]=arguments[u+2],++u;u=new gc(B,0,null)}return g.j(k,t,u)}throw Error(\&quot;Invalid arity: \&quot;+arguments.length);};f.o=2;f.u=g.u;f.s=e;f.g=d;f.h=c;f.j=g.j;return f}()} </code></pre> The output is correct as far as I can tell but that&#x27;s some pretty hairy Javascript right there.<p>Edit: Formatted code.
评论 #30426647 未加载
评论 #30428029 未加载
评论 #30427557 未加载
评论 #30426741 未加载
globular-toastabout 3 years ago
Looks good but it absolutely <i>needs</i> matching paren highlighting. Having to count parens manually will put a lot of people off.
gavinrayabout 3 years ago
How do people who write Clojure deal with lack of type checking?<p>And auto-complete when it comes to Java library interop?<p>I tried Clojure, to build a tool on top of a popular Java library that I was new to.<p>And compared to other JVM languages it was not good because there was no type-checking or intellisense&#x2F;autocomplete popups for the methods.
评论 #30428354 未加载
评论 #30428345 未加载
评论 #30428402 未加载
评论 #30428589 未加载
评论 #30431671 未加载
评论 #30431705 未加载
评论 #30428363 未加载
评论 #30429615 未加载
评论 #30429013 未加载
agumonkeyabout 3 years ago
Quite timely, someone was asking about newcomers troubles learning clojure and this will probably help a lot :)
JJseikoabout 3 years ago
Thanks for this! I just finished the tutorial and really enjoyed it! Found myself hoping for more. Maybe a small series that would teach one the necessary basics of Clojure so one could actually do a real project in it afterwards. That would be awesome :)
评论 #30435987 未加载
forlornabout 3 years ago
Do I need to have a somewhat decent knowledge of Java to plunge into Clojure right away?
评论 #30425412 未加载
评论 #30424325 未加载
评论 #30425075 未加载
评论 #30424348 未加载
评论 #30424284 未加载
评论 #30426035 未加载
评论 #30424430 未加载
评论 #30424372 未加载
评论 #30426069 未加载
pjmlpabout 3 years ago
Quite nice tutorial, well done.
asicspabout 3 years ago
Looks good. Is there a way to go back to previous step?<p>Also, please use &quot;Show HN&quot; for own submissions like this project (see <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html</a> for details).
评论 #30425545 未加载
iamcreasyabout 3 years ago
Can I use Clojure instead of Scheme when working through SICP?
评论 #30430910 未加载
pmohunabout 3 years ago
this was a lot of fun. thanks for sharing!