Fork me on GitHub
#clojure
<
2019-05-31
>
kartik715304:05:27

Hi, is there a something equivalent to GOPROXY in maven for fetching dependencies. In our CI whenever it tries to build a jar it fetches the dependencies every time from Clojars.

hiredman05:05:24

It sounds like using docker without keeping your .m2 cache between builds, so persist your m2 between builds

kartik715305:05:10

But to build up m2 it will still fetch it from clojars right,

dominicm05:05:34

Only the first time

danielneal10:05:24

Anyone got any preferences for picking things out of parsed xml these days? I like the look of the approach in https://juxt.pro/blog/posts/xpath-in-transducers.html but there's no library there or anything, just some notes - wondering if maybe there's something out there now

bronsa11:05:07

maybe try spectre

book_guy 4
☝️ 4
eval-on-point14:05:52

Anyone here have experience with Clj on Windows through PowerShell versus Windows Subsystem for Linux?

mloughlin15:05:40

I use clj with powershell

thanks2 4
mloughlin15:05:04

it seems fine?

Jakub Holý (HolyJak)15:05:30

I want to read a long file, processing the lines, without keeping all of it in the memory. Is there a nice way to ensure the resource is closed once the whole line-seq is consumed? I guess I could wrap the processing in a transducer as they have the 1-arg "completion" arity... Thoughts? Thanks!

tavistock15:05:03

this might help, its from data csv but it might apply to whatever you are doing https://github.com/clojure/data.csv#laziness

Jakub Holý (HolyJak)15:05:20

Thank you. The proposed solution - move with-open up - is usable but not as nice :)

Ben Hammond15:05:13

@U0522TWDA I've had success with things like

(defn csv-maps
  "generic low overhead way to turn (massive) csv file
   into lazily evaluated stream of maps"
  [ff & opts]
  (reify clojure.lang.IReduceInit
    (reduce [_ f init]
      (with-open [^BufferedReader r (jio/reader ff)]
        (let [hdr (first (apply csv/read-csv (.readLine r) opts))]
          (transduce (map (partial zipmap hdr))
                     (completing f)
                     init
                     (apply csv/read-csv r opts)))))))

Ben Hammond15:05:46

you can reduce over that and you get maps of the row data

Jakub Holý (HolyJak)16:05:06

Thank you! Does it close properly when there is an exception during the processing?

Ben Hammond16:05:06

yeah the with-open should take care of that

Ben Hammond16:05:38

it expands to a

(try
...
(finally (.close

dpsutton18:05:12

is it correct that you can never see two sequential reader macros?

hiredman18:05:41

I don't think it is, I have never seen it done, but I believe that is supported behavior

hiredman18:05:02

sorry, no, I am thinking of tag literals

hiredman18:05:08

for reader macros, you can for exmaple, do things like #_#'+

dpsutton18:05:13

ah i think i am more precisely talking about tag literals. #js, #uuid, etc

hiredman18:05:23

yeah, tag literals stack

dpsutton18:05:42

makes sense i suppose. its just function composition, yes?

hiredman18:05:01

well sure, but the way the reader works it is basically "read the next form and hand the read result to this function", and if the next form is also a tag literal it just does that again

dominicm18:05:12

Aero configs use this a lot