Live data from Hacker News

Love Letter to Clojure

itrevolution.com

1–10 of 19 posts

Re: Love Letter to Clojure

#2
> I will discuss the following:

> * What the Second Ideal of Focus, Flow and Joy Means to Me Relearning Coding: How Coding Mostly Left My Daily Life in 2008, But Came Back in 2016 (or If I Can Learn Clojure, Anyone Can)

> * Why I Love LISPs Now

> * Functional Programming and Immutability (and John Carmack)

> * A Mistake I’ve Been Making Since Grad School, and How I Fixed It: Composability

> * The Epiphany I Had Reading “An Introduction to React in 2019 (For People Who Know Just Enough jQuery To Get By)”

> * What Rich Hickey Says About Simplicity: Where The First Ideal Of Locality and Simplicity Comes From

> * Solving Business Problems, Not Solving Puzzles—Why I Detest Doing Infrastructure Work These Days

> * Lastly, the REPL…the Ultimate in Fast and Fun Feedback Loops!

> * The Amazing Clojure Community, Parting Thoughts, and What I’d Like To Write About in the Future

Re: Love Letter to Clojure

#3
> Contrast LISP to the complicated order of precedence operations you find in almost every other programming language, as well as their huge grammars and syntax. That takes a lot of brain space.

I disagree. I rarely find myself slowed down by the grammar or operator precedence in Java and C#. In C++, only when I have to do something rather esoteric (pointer-to-member, member function template specializations, etc.).

On the other hand, I critically rely on types. The IDE is able to narrow down suggestions about applicable methods to a handful. But since `js->clj` is a function `string -> map` (a very generic signature), there must be hundreds of them with the same signature. Context-sensitive discoverability with the help of IDE becomes nearly useless.

Yes, that's how I learn APIs these days. Types, intellisense + reading the documentation to learn about possible edge cases. I cannot imagine being productive in something like Clojure.

I also find Java 11 + VAVR rather pleasant to work with.

Re: Love Letter to Clojure

#4
I use Racket to create programming languages, however I am considering getting into Clojure for web development. Racket's web development ecosystem is actually pretty great, I'm just curious about Clojure's.

Might someone who's played with both give me some pro's and con's of Racket vs Clojure?

Re: Love Letter to Clojure

#5
post #3

> Contrast LISP to the complicated order of precedence operations you find in almost every other programming language, as well as their huge grammars and syntax. That takes a lot of brain space. I disagree. I rarely find myself slowed down by the grammar or operator precedence in Java and C#. In C++, only when I have to do something rather esoteric (pointer-to-member, member function template specializations, etc.).…

If you are interested in a typed Lisp experience, I highly recommend Typed Racket :)

https://docs.racket-lang.org/ts-guide/

Re: Love Letter to Clojure

#6

I use Racket to create programming languages, however I am considering getting into Clojure for web development. Racket's web development ecosystem is actually pretty great, I'm just curious about Clojure's. Might someone who's played with both give me some pro's and con's of Racket vs Clojure?

I’ve heard this a few times - that racket (or any lisp, closure(script) aside) plays well with the web - but have never seen much to back it up.

Could you point me in the direction of any good resources, libraries, or communities to dig in further?

Re: Love Letter to Clojure

#7
I feel similarly to Gene Kim about Racket. Here's a comparison ...

Gene Kim's Clojure example:

  ; input is JSON string: "{foo: 2}"

  (defn xform [s]
    (-> (js/JSON.parse s)
        js->clj
        (update "foo" + 2)
        clj->js
        js/JSON.stringify))

Racket equivalent:

  #lang racket

  (require threading json)

  ; input is (xform "{\"foo\" : 2 }")

  (define (xform s)
    (~> s
        string->jsexpr
        (hash-update 'foo (λ (x) (+ 2 x)))
        jsexpr->string))

Re: Love Letter to Clojure

#8
post #7

I feel similarly to Gene Kim about Racket. Here's a comparison ... Gene Kim's Clojure example: ; input is JSON string: "{foo: 2}" (defn xform [s] (-> (js/JSON.parse s) js->clj (update "foo" + 2) clj->js js/JSON.stringify)) Racket equivalent: #lang racket (require threading json) ; input is (xform "{\"foo\" : 2 }") (define (xform s) (~> s string->jsexpr (hash-update 'foo (λ (x) (+ 2 x))) jsexpr->string))

This is a strange comparison. ClojureScript looks bad here because it's using the native platform interop rather than a wrapped library, but the ability to easily drop down and interact with the host is one of the best parts of Clojure.

Re: Love Letter to Clojure

#9

I use Racket to create programming languages, however I am considering getting into Clojure for web development. Racket's web development ecosystem is actually pretty great, I'm just curious about Clojure's. Might someone who's played with both give me some pro's and con's of Racket vs Clojure?

I’ve heard this a few times - that racket (or any lisp, closure(script) aside) plays well with the web - but have never seen much to back it up. Could you point me in the direction of any good resources, libraries, or communities to dig in further?

Server side web development is probably the area where Clojure is used most, perhaps in combination with clojurescript on the front end.

A small google will take you to plenty of resources and libraries.

Re: Love Letter to Clojure

#10
post #7

I feel similarly to Gene Kim about Racket. Here's a comparison ... Gene Kim's Clojure example: ; input is JSON string: "{foo: 2}" (defn xform [s] (-> (js/JSON.parse s) js->clj (update "foo" + 2) clj->js js/JSON.stringify)) Racket equivalent: #lang racket (require threading json) ; input is (xform "{\"foo\" : 2 }") (define (xform s) (~> s string->jsexpr (hash-update 'foo (λ (x) (+ 2 x))) jsexpr->string))

Actual comparison with Clojure:

  (require [clojure.data.json :as json])

  (defn xform [s]
     (-> s
         json/read-str
         (update "foo" + 2)
         json/write-str))
Your example is Clojurescript with interop
Post reply on HN