Earlier quoted context omitted.
That's because this is actually ClojureScript (JS under the hood) running as a browser library. If you try that in Clojure, you'll get: > ClassCastException class clojure.lang.PersistentList cannot be cast to class java.lang.Number If you try it in a "proper" ClojureScript dev environment (shadow-cljs), you get nil as a result with this warning: > cljs.core/+, all arguments must be numbers, got [number cljs.core/ILis…
Thats actually good to know, I thought this was reflective of Clojure itself.
Try Clojure
201–210 of 404 posts
Re: Try Clojure
#202Earlier quoted context omitted.
The best part about Babashka is that it's really batteries included nowadays. I had to make a little UI to display some stats about an app at work, and decided to try using it with HTMX. Turned out to be a really good experience. Babashka has pretty much everything you need for a basic web app baked in, and HTMX lets you do dynamic loading on the page without having to bother with a Js frontend. Best part is that bb…
I agree. It's a breath of fresh air in the Clojure world. I'm grateful to thoughtful builders like yourself and borkdude for bringing the language to new heights.
Re: Try Clojure
#203I have to admit, several years ago, a colleague of mine advised me if not to try Clojure but at least to read the "History of Clojure": https://dl.acm.org/doi/pdf/10.1145/3386321 , which I never did. But one day I decided to watch Rich Hickey - Greatest Hits https://changelog.com/posts/rich-hickeys-greatest-hits ... I then read the "History of Clojure", and then jumped into learning it. This is probably one of the mo…
I got what you described by learning Common Lisp just a few months ago. Do you think learning Clojure would get me something in addition to that or is it roughly the same?
Re: Try Clojure
#204Clojure for the Brave and True by Daniel Higginbotham is a truly great resource to learn Clojure. I highly recommend it. It is also free online [0]. [0]: https://www.braveclojure.com/clojure-for-the-brave-and-true
Re: Try Clojure
#205So here's something which I, as a Lisper, don't understand: Clojure has syntax for hash tables (the curly braces), why doesn't it use those for let-bindings, instead choosing to use vector syntax? (Of course I prefer standard Lisp syntax which can easily be extended for multiple-value and destructuring bindings: (let ((a 1) ((b c) (list 2 3)) (d e (values 4 5))) `#(,a ,b ,c ,d ,e)) ;; => #(1 2 3 4 5)
Maps are unordered, but let bindings are sequential so order matters.
Re: Try Clojure
#206Earlier quoted context omitted.
I'm one of those mainstream devs (who also did Clojure for 6 years, coincidentally) who never got into emacs, and always just used the Cursive IDE plugin for IntelliJ and its Parinfer editing mode. I know I probably didn't unlock true god mode of productivity, but it worked fine for me.
I had already used vim by the time I found clojure during uni (back when I had the energy to learn major new things), but vim support sucked for things like evaluating code blocks in the buffer, so I tried emacs and immediately slapped on evil-mode (vim bindings inside emacs). For those six years I don't think I used emacs keybindings during that time except to move between files and execute clojure code. I couldn't…
Re: Try Clojure
#207Earlier quoted context omitted.
In my experience jumping from a Clojure shop to a large Java shop a few years ago, the benefits of persistent data structures are overstated. Mutable collections are just as good for 99% of use cases. And they're a lot faster (in single threaded code) and occasionally mutation makes things easier. The selling point of Clojure is that persistent data structures prevent several classes of bugs (unintended mutation, loc…
Looking at an object in my debugger back in my call stack and assume I'm looking at the value as it was but in reality it was mutated in a subsequent stack gives me trust issues It's probably fine most of the time it's just when I have to get into the weeds I want to have stability
Re: Try Clojure
#208i wish it was easy to make android apps with clojure. not sure if itd be easier with jetpack compose + clojure or react native + clojurescript.
Re: Try Clojure
#209My Clojure experience was that basic dev experience things were shockingly behind where any other moderately popular lang is at. It's been some time though so all I remember clearly is bad error output. Stack traces are hard to read unless you install $random_lib. But worse than stack traces are type errors/"Java errors": if you give the wrong args to a function, the error output is completely inscrutable, generally…
https://github.com/clojure/clojure/blob/master/src/jvm/cloju...
But like, where is the javadoc? What exactly is supposed to be the contract of these methods `first`, `next`, `more`, `cons`? What's the difference between `next` and `more`?
I really just don't like that. Are we just supposed to pick up the core contracts/abstractions through oral teachings and slack channel messages?
Re: Try Clojure
#210this is super neat! how did you set up your fonts folder? what tooling did you use?
Tooling is a combo of Shadow CLJS and Clojure CLI.
[0] See `resources/public/fonts` here: https://github.com/eliascotto/tryclojure/tree/main/resources...