Fork me on GitHub
#clojure
<
2019-10-17
>
vdmit1102:10:10

Hi folks! Could you recommend a decent Clojure project with good code, where you could learn by reading the code? I mean, documentation is ok, but in practice, there is a lot of tricks and various "meta" knowledge, like: project structure, initialization code, configuration, logging, tests, docstrings, code conventions, idioms and tricks. To me, the best way to learn these things is by example, that is, to read some good code. So I'm seeking for a project with clean code that I could just browse and learn there. Any suggestions?

dpsutton02:10:51

tasteful protocols, extending to java types, defmethods, etc

igrishaev08:10:43

A JDBC-related question: When I pass a Timestamp as a parameter into a query, I get it back as a string:

["select ?" (new java.sql.Timestamp 1571300133993)]
({:?column? "2019-10-17 11:15:33.993000+03"})

igrishaev08:10:10

Is there is an option to get it back as instance of a Date/Timestamp/etc class?

igrishaev08:10:32

Actually, I’ve figured out using PGObject:

(doto (new PGobject)
      (.setType "timestamp")
      (.setValue "2019-10-17 11:25:29.299563+03"
but I don’t like the idea to covert it to a string manually.

igrishaev09:10:16

No, this is not what I was asking about

kardan09:10:46

Ah ok. Sorry was a bit unfocused on my end thought it might help.

gibb09:10:18

Don’t you have to use resultSet.getTimestamp in java to get it as a timestamp?

gibb09:10:51

Ah maybe I’m misunderstanding you. Is it the query you’re talking about?

igrishaev10:10:21

Yes, the query is ["select ?"] and the parameter is a Timestamp

myguidingstar13:10:29

@U1WAUKQ3E what about ["select cast(? as timestamp) as q" (new java.sql.Timestamp 1571300133993)]

nhlx211:10:35

A basic sanity check question question:

nhlx211:10:59

Why is (Math/sin Math/PI) not zero?

dpsutton13:10:16

I would imagine due to how hard it is to represent PI. Easy on paper but with 64 bits you can only get close to PI. And the sine of close to PI is not zero

Conor12:10:09

Have a look at the Javadoc @nhlx2 - you are only guaranteed a result within 1 ulp of the actual result

borkdude15:10:11

I have a vec of CSLItemData. I convert them to an array using (into-array CSLItemData the-vec) and pass that to the constructor. but I still get a reflection warning. how to avoid it?

borkdude15:10:43

got it:

(ListItemDataProvider. ^"[Lde.undercouch.citeproc.csl.CSLItemData;" item-datas)

hiredman15:10:54

Easiest would be type hinting vec as a java.util.list and not bothering with the array

borkdude15:10:16

it's not about vec or array I think but about the inner type

borkdude15:10:52

alright, I'll try the java.util.List - the reflection warning is gone 🙂

dominicm16:10:06

Are there alternative ways of doing for's matrix of arguments? Obviously I can use it to just create a vector and pass that wherever, but I was wondering if there was another function which provided some alternative approach? In particular I'm using this with reduce.

bfabry16:10:19

for is the only list-comprehension-like construct I know of in core

emccue17:10:21

Starting to work with seesaw and was wondering if there was some documented set of things i would need to do to make a swing component "behave" with it

emccue17:10:25

org.apache.batik.swing.JSVGCanvas

emccue17:10:34

this is the only one that i am thinking of right now

emccue17:10:10

i know from some slides that there is a Value protocol and listen-for-named-event

emccue17:10:34

but all of that seems to be very much "private" in the sense that how to impl them is opaque (at least to me)

borkdude18:10:28

@hiredman thanks for the hint (pun intended!)

emil0r19:10:24

Anyone got an idea if there is something in Java/Clojure updates that would break https://github.com/Raynes/bultitude ?

nwjsmith19:10:36

@emil0r there is, it’s broken in later versions of Java iirc

emil0r19:10:01

Know of any fix?

nwjsmith19:10:01

I think later versions (0.3.0) use a newer version of dynapath which fixes the issue