Fork me on GitHub
#clojure
<
2016-10-09
>
richiardiandrea04:10:50

@borkdude maybe I am late but I think I have often heard "dependency vector"

sveri15:10:51

Hi, I have a REST api where one endpoint takes amongst others a time field as input. Two questions: 1. what is considered idiomatic regarding the apis input. I always assumed passing around UNIX timestamps is a good thing to do. Opinions on that? 2. How do you handle these timestamps in clojure, especially if you want to store them in a relational database later. I see myself juggling JodaTime (java 8), java.sql.Time for postgres and clojure.instant right now, having clj-time in the back of my head as a fourth option.

borkdude15:10:11

nice puzzle question: - What’s a good way to inline a function call in a clojure file. For example suppose there was something like (+ 1 2 3) among the source, and I wanted to mutate the source file by inlining this to 6.

sveri15:10:45

@borkdude why not let the java compiler do the work?

borkdude15:10:35

@sveri I give you this file:

(ns foo)
;; hello world
(println (+ 1 2 3))
. what would you do to inline (+ 1 2 3) and maintain the rest of the file, including comments, etc.?

sveri15:10:43

@borkdude without some more context I would say I let it do the java compiler later and not care about it at all.

sveri15:10:15

following the golden rule: the best code written is the code that is never written.

borkdude15:10:35

@sveri the Java compiler can output this file for me?

sveri15:10:03

nope, but it will inline the code later on compilation part

sveri15:10:09

at least not that I am aware of

borkdude15:10:55

@sveri some more context then. suppose I want to give users of this library: https://github.com/borkdude/boot-bundle the possibility to inline the call to expand-keywords, so they get a ‘normal’ build.boot file without a dependency on my library

borkdude15:10:46

I could use string search/replace, paren matching, eval, but maybe there is a much better way. tools.analyzer?

sveri16:10:45

@borkdude In that context most probably a simple search/replace will do I think

borkdude16:10:19

it seems tools.analyzer also drops comments

jrheard17:10:36

@borkdude have you seen https://github.com/xsc/rewrite-clj ? i’ve seen other people suggest it in situations like yours

jrheard17:10:46

haven’t used it myself, apologies if it’s irrelevant

dpsutton17:10:57

i'm trying to learn how to reference local maven builds. So far, I'm following the default build for maven as seen here : https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

dpsutton17:10:14

I'm running into trouble in figuring out how to reference it

dpsutton17:10:00

This is from the pom file, and I have run mvn install

dpsutton17:10:29

it's correctly in my m2 directory. And I can add it to my project file [com.mycompany.app.my-app "1.0-SNAPSHOT"]

dpsutton17:10:38

However, I'm not sure how to reference it in my core.clj file

dpsutton17:10:01

(:require [my-app.app/App :as a]) keeps coming back as missing the init class

dpsutton17:10:55

Anyone have any ideas?

dpsutton17:10:06

and other permutations on app.my-app/App, etc

alexmiller17:10:28

Depends what the namespace of your Clojure code is (this is totally independent from the name of artifact)

dpsutton18:10:39

That's strange to me that the name of the artifact would vary depending upon the namespace of my code

dpsutton18:10:39

i'm working on updating some cider documentation when using locally built and installed maven dependencies.

dpsutton18:10:46

The entirety of the code is as follows

borkdude18:10:26

@jrheard not seen it before, taking a look now

paulspencerwilliams19:10:58

Hey, does anyone know any ways of bounding an InputStream so I can reference say the 4th MB of data from a large binary file as an InputStream to clj-http. I’ve used BoundedInputStream in java but wondered whether Clojure offered a better solution? Something like take would only defer realization wouldn’t it?

donaldball20:10:56

If efficiency is the primary consideration, I’d probably look at java.nio to mmap the large binary file: https://docs.oracle.com/javase/7/docs/api/java/nio/MappedByteBuffer.html

borkdude21:10:42

How does crossclj work? I’m looking at projects that use clojure.tools.reader and reagent is one of them. When I look into the project.clj of reagent, tools.reader is not there. Does crossclj list it because it depends on it indirectly?

Tim21:10:48

is there any examples of using sente with plain javascript?