Live data from Hacker News

Abstract Clojure

juxt.pro

31–40 of 43 posts

Re: Abstract Clojure

#31
post #3

I also recommend the book "Grokking Simplicity" by Eric Normand for a longer exploration of functional software design (not Clojure-specific). The linked blog post uses Clojure examples, but this approach to software design is universally applicable (especially in functional programming!).

Great book. Great podcast by him as well: https://lispcast.com/category/podcast/

Re: Abstract Clojure

#32
post #29

> The protocol is another form of abstraction we can use to decouple modules, the approach is more object-oriented than functional That's not true that the approach is more OO. People get confused because a lot of OO languages like Java eventually added support for something protocol-like, in Java it was interfaces for example, but for a long time Java, an OO language, didn't have interfaces, you only had Classes and…

Are you sure about Java? http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/ talked about interfaces in 1996 and I don’t remember any version that didn’t have them.

java 1.0 most definitely had interfaces.

smalltalk on the other hand, did not have explicit interfaces: http://www.jot.fm/issues/issue_2002_05/article1/

Re: Abstract Clojure

#33

Earlier quoted context omitted.

Not writing Java (although you do have to do lots of interop with Java).

It's true it's "not writing Java", that's true for every language besides Java! But the second part is definitely not true. First, you can very much use JVM Clojure without touching Java, I've done so many times. Secondly, you can use ClojureScript which cannot even do interop with Java since it "compiles" to JavaScript and doesn't run on the JVM. Thirdly, you can use Babashka to run Clojure code with GraalVM and SCI…

If you are writing toy programs in your mom's basement sure but every real world clojure project I have work with had to use Java libraries.

When I said 'not writing Java' I was obviously talking about the JVM.

Re: Abstract Clojure

#34
post #9

What is Clojure's main selling point?

If you have an hour spare, probably the best way to understand Clojure's main selling points is to watch this talk: https://www.infoq.com/presentations/Simple-Made-Easy/ InfoQ list the Key Takeaways as: - We should aim for simplicity because simplicity is a prerequisite for reliability. - Simple is often erroneously mistaken for easy. "Easy" means "to be at hand", "to be approachable". "Simple" is the opposite of "co…

There's also transcripts of this and other Rich Hickey talks available: https://github.com/matthiasn/talk-transcripts/blob/master/Hi...

Re: Abstract Clojure

#35
post #9

What is Clojure's main selling point?

Not writing Java (although you do have to do lots of interop with Java).

I've seldom had uses for Java interop, once in a blue moon. An exception is FP math functions and constants, using those from java.Math via interop instead of having a native math library has been the Clojure way (but seems getting a native wrapper in Clojure 1.11, clojure.java.math).

Re: Abstract Clojure

#36
post #9

What is Clojure's main selling point?

It's very good and straight to the point about transforming data. The central data structures (maps, keywords, vectors) and excellent languge + standard library centered around those, combined with interactive iteration at the REPL, make for a rewarding development experience when you can just try stuff. Since most things are immutable and passed around as data, you can easily rerun things at the REPL with high confidence that objects in your data aren't being mutated.

Re: Abstract Clojure

#37

Earlier quoted context omitted.

It's true it's "not writing Java", that's true for every language besides Java! But the second part is definitely not true. First, you can very much use JVM Clojure without touching Java, I've done so many times. Secondly, you can use ClojureScript which cannot even do interop with Java since it "compiles" to JavaScript and doesn't run on the JVM. Thirdly, you can use Babashka to run Clojure code with GraalVM and SCI…

If you are writing toy programs in your mom's basement sure but every real world clojure project I have work with had to use Java libraries. When I said 'not writing Java' I was obviously talking about the JVM.

> If you are writing toy programs in your mom's basement sure but every real world clojure project I have work with had to use Java libraries.

That's OK, most real world Clojure and ClojureScript projects I've worked on didn't had to use Java libraries, maybe 10% of them had to have Java code or used Clojure-wrapped Java libraries. Everyone's experience is different :)

> When I said 'not writing Java' I was obviously talking about the JVM.

Yeah, that's not super obvious as normally people consider Java the language to be something else than JVM the runtime.

Re: Abstract Clojure

#38
post #29

> The protocol is another form of abstraction we can use to decouple modules, the approach is more object-oriented than functional That's not true that the approach is more OO. People get confused because a lot of OO languages like Java eventually added support for something protocol-like, in Java it was interfaces for example, but for a long time Java, an OO language, didn't have interfaces, you only had Classes and…

The same Java that took the interfaces idea out of Objective-C protocols on version 1.0?

Re: Abstract Clojure

#40
post #29

> The protocol is another form of abstraction we can use to decouple modules, the approach is more object-oriented than functional That's not true that the approach is more OO. People get confused because a lot of OO languages like Java eventually added support for something protocol-like, in Java it was interfaces for example, but for a long time Java, an OO language, didn't have interfaces, you only had Classes and…

Are you sure about Java? http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/ talked about interfaces in 1996 and I don’t remember any version that didn’t have them.

Hum, guess you're right. For some reason I thought they introduced them in 1.3.
Post reply on HN