Fork me on GitHub

@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).


@markx for binary file i/o, have you looked at buffy?


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.


Otherwise, I feel that I would be always thinking in Java, but not Clojure.


@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 know almost no java


i'm a C# background at work


I live almost exclusively in clojure


and have never written java for a clojure project


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?


i have never run across that requirement


@markx in my experience @donaldball is right — file i/o accounts for pretty much all of my use of java interop in clojure


hmm. What do you do mostly?


@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


@pat.fogarty It’s actually helpful and introduced me all the concept of File, inputStream… which is why I got more lost and frustrated.


@seancorfield Thanks. I’ll come back when I have more questions.


@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 API call in Clojure equivalents and Java interop shows through. Although the namespace wraps a lot of that too.


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


cannot find anything on or similar pages


:require-macros is something you have to do in ClojureScript, because even though ClojureScript looks like Clojure syntactically, it is not the same thing.


ClojureScript doesn’t have macros.


using refer-marcros


oh i get it now


you can pull one in


“pull one in"


i use the phrase loosely


thank you very much for that


Hey guys, so I’m trying to use clojurewerkz/buffy, and got a question. How do I create a spec that includes , say int32_type, and a frame-type?