This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (46)
- # boot (65)
- # cider (8)
- # cljs-dev (5)
- # cljsrn (4)
- # clojure (50)
- # clojure-conj (2)
- # clojure-france (1)
- # clojure-greece (18)
- # clojure-russia (8)
- # clojure-spec (39)
- # clojure-uk (36)
- # clojurescript (36)
- # clr (16)
- # component (2)
- # cursive (6)
- # datascript (3)
- # datomic (31)
- # devcards (2)
- # editors-rus (1)
- # emacs (15)
- # events (2)
- # figwheel (1)
- # funcool (24)
- # garden (3)
- # hoplon (22)
- # instaparse (15)
- # leiningen (3)
- # luminus (4)
- # om (59)
- # onyx (24)
- # overtone (1)
- # pedestal (3)
- # planck (18)
- # prelude (1)
- # protorepl (2)
- # re-frame (5)
- # rum (1)
- # sql (1)
- # uncomplicate (1)
- # untangled (66)
- # vim (18)
- # yada (4)
@agile_geek Hi, thanks for the comment a few days ago about that I don’t need to learn ‘Java’ to use Clojure. I googled about this and found many had the same opinion. However as I moved forward, I found it really hard to do anything without java knowledge.
I’m still struggling about parsing a binary file. I learnt about File, Inputstream, ByteBuffer, even if I’m trying to avoid all this by using a wrapper.
I found that, most projects that are wrapping java api, if not all, don’t have a complete document explaining the background knowledge. They seem to assume that you already know all the java related knowledge.
I believe that, while some use those wrapper libs to be more idiomatic, there are still people like me, that want to use them as the abstraction above Java, so that we don’t get blocked by java.
@markx I think it’s fair to say you don’t need to “learn Java” to use Clojure but you do need to learn Clojure’s interop features and you do need to learn some of the (Java) Standard Library. You also need to know something about the JVM ecosystem that Clojure is hosted on.
You need to be able to read Java and figure out the equivalent Clojure — but that shouldn’t need much specific knowledge of Java itself. Much will depend on what other languages you already know, of course.
In my own experience of learning Clojure, I found the process enjoyable and exciting. However when I tried to actually build something in Clojure, I ended up learning more about Java, instead of Clojure.
If you’re completely new to programming then, yes, there’s a lot to learn in order to write useful real-world Clojure programs. If you know Python or Ruby or something, then reading Java should be relatively familiar — although the ecosystem itself will have some new “warts” to learn.
We have over 40K lines of Clojure and there’s only a handful of places where we rely on Java interop — but we don’t do a huge amount with files, just databases (and there are libraries for that).
I really hope that some day, you can do everything you want in pure Clojure, without knowing anything about java ecosystem more than the fact that it’s hosted on jvm. I really wish that that the interop would be optional.
@pat.fogarty Yes, this is lib I am trying to use. I spent a few hours to find out that it’s only a wrapper around the
ByteBuffer. However, the problem how to read a bin file, and how to use a
ByteBuffer, is not taken care of.
@seancorfield I believe I’m quite fluent in js and Python, and I’m not new to programming at all. But I still feel very lost learning Clojure.
I’m wondering if there’s anyone that uses Clojure well without Java knowledge. I tend to believe that those claiming that you don’t need to learn much java to learn Clojure, are actually fluent in Java beforehand , and just don’t realize that.
I dunno. Any time you’re doing I/O you’re already hitting the boundary between language and its host environment. That’s always a point where you have to learn more than just the language, I think.
@dpsutton That’s comforting and encouraging to know! Do you know how to read and parse a binary file?
@markx for binary file I/O does the clojure cookbook entry help? https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-19_handle-binary-files.asciidoc
@loganmhb That’s also good to know… Maybe I just happened to choose the wrong challenge to tackle.
Reading a binary file is probably the optimal way to have to do java interop in clojure haha
This SO answer has several suggestions http://stackoverflow.com/questions/23018870/how-to-read-a-whole-binary-file-nippy-into-byte-array-in-clojure
@pat.fogarty It’s actually helpful and introduced me all the concept of
File, inputStream… which is why I got more lost and frustrated.
@markx I agree with @seancorfield on this. In fact you're a little unlucky in the use case you choose as file I/O is one of the only places where nobody felt it particularly useful to wrap every http://java.io API call in Clojure equivalents and Java interop shows through. Although the
namespace wraps a lot of that too. https://clojure.github.io/clojure/clojure.java.io-api.html
You certainly don't need to know Java syntax, OO concepts, or most of the J2SE API to use Clojure. You need a handful of Java specific things but this, to me, is the same as; you need to learn a handful of Clojure collection functions. Just more stuff to learn.
The most awkward thing is probably stack traces from the JVM as they're not that friendly.
hey guys, I am new to clojure and trying to check it out. I am looking for a reference to :refer-marcros
:require-macros is something you have to do in ClojureScript, because even though ClojureScript looks like Clojure syntactically, it is not the same thing.