Fork me on GitHub
#clojure-uk
<
2020-08-14
>
seancorfield04:08:10

Sheesh, you're an early bird! πŸ™‚

jiriknesl04:08:46

Normally I wake up 4:25am. But ATM I am on holidays in Greece so we already have 7am πŸ™‚

seancorfield04:08:01

(my alarm goes off at 8:45 am!)

seancorfield04:08:38

(my alarm goes off at 8:45 am!)

jiriknesl04:08:42

I guess you go to bed very late.

jiriknesl04:08:59

I am absolutely dead 10:30pm every day

seancorfield04:08:00

11 pm is an early night for me. Midnight is my preferred bed time.

seancorfield04:08:58

Even with an 8:45 am alarm, I'm dragging my carcass out of bed and I'm useless until I've had a big, strong mug of freshly-ground dark roast coffee!

jiriknesl06:08:19

That’s why you can do so long development sessions. When I wake up 4:25am, usually at 4:26am I am already practicing italian words in Anki. I burn a lot of energy long before I start doing anything creative.

djm06:08:48

πŸ‘‹

seancorfield06:08:55

I'll be honest: I find writing code relaxing. If I wasn't a software developer by trade, I'd still write code for fun. I think it's why I've been doing OSS development for nearly 30 years now.

dharrigan06:08:32

Good Morning!

alexlynham08:08:31

i'm an extreme night owl, i think my natural body clock is to sleep at 1:30-2am

alexlynham08:08:58

cycles of wakefulness are roughly 90 mins though iirc so i find there's usually a very thin window at about 10-10:30pm where my energy dips and i can sleep if i've not had caffiene in the pm, but it's uncanny... if i don't get to sleep fast, i jolt awake & i'm up til 1:30 haha

dominicm08:08:42

Long after I've been automated out of a job by no code tools and WordPress, I'll be using voice dictation to program unix utilities for fun.

Jakob Durstberger08:08:59

Happy Friday! πŸ™‚ Dang, I can’t deal with being up late at all. I sleep from 22:00 - 5:30. I really prefer the mornings

dharrigan08:08:27

With a 3 year old kid, I have no choice πŸ™‚ Today it was 4:10. Yesterday was 4:30, day before was 4:51. At this rate, he'll be getting up before he goes to bed.

Conor10:08:15

Do they still show 'Me Too' on CBeebies really early in the morning? I remember watching that several times

dharrigan10:08:22

only starts from 6am

dharrigan10:08:15

and it's Something Special at that time, followed by the Twirly Woos, then Teletubbies, then Timmy, then Bing, then Hey Duggee, then Go Getters, then Peter Rabbit, then Octanauts...

dharrigan10:08:20

I know the schedule well

Ben Hammond11:08:21

I've not seen Riverseafingal on CBeebies for ages

Ben Hammond11:08:45

its all Molly and Mack nowadays

Ben Hammond11:08:58

and alot of Katie Morag

Ben Hammond11:08:04

and the utterly insipid Topsy and Tim ugh

Conor11:08:01

Topsy and Tim's mother is clearly popping pills to cope with them

rickmoynihan11:08:47

Hey Duggee:ok_hand:

minimal13:08:30

Tinpo in 10 minutes

dharrigan14:08:58

tbh, my favourites atm are Sarah and Duck - very trippy and JoJo and Gran Gran πŸ™‚

maleghast15:08:29

Hey y'all I am having a Clojure-Fu and Google-Fu failure... I have a BIG lazy seq that is a seq of maps. I want to turn it into a text file representing EDN or JSON (not bothered which). How can I do this without blowing the stack - I am worried that if I turn the whole seek "real" and then into a string in order to spit it, I will have a problem. I am sure that there must be an appropriate way to stream the seq out to a textfile, but I am struggling to get Google to understand me and it keeps showing me examples for smaller data structures where the questioner cares about line breaks and so forth - I don't, I just want to persist the data in such a way as I can read it back in...

mccraigmccraig15:08:34

reduce the seq onto the output-stream

seancorfield15:08:30

Output [, then each element, followed by ,, then output ], you mean?

maleghast15:08:39

@U0524B4UW - that sounds like what I am looking for, thx

mccraigmccraig15:08:40

EDN is slightly easier than JSON too 'cos no separators required, but then there's JSON-lines too

maleghast15:08:08

@U0524B4UW EDN works for me... If you had to find an example what would you Google for..?

mccraigmccraig15:08:15

not much of an answer, but i probably wouldn't - i tend to prefer playing in a repl to googling for potted solutions

maleghast15:08:24

That's fair - I don't want to simply lift and shift the code, I just find that I grok things more easily if I can see how it's been done πŸ™‚

maleghast15:08:53

Playing in the REPL is fine when I know even roughly what I am doing...

maleghast15:08:20

....but when I have literally no clue I just find it intimidating and I don't know where to start

mccraigmccraig15:08:32

this shows the idea

mccraigmccraig15:08:37

(reduce (fn [out v] (.write out (prn-str v)) out) *out* [1 2 3])

maleghast15:08:54

Ok, thanks I will start from there, this makes more sense to me.

seancorfield16:08:14

We do a similar trick producing a huge JSON doc as a dump of all member-related data in the database (when they do a GDPR request).

mccraigmccraig16:08:08

yep, we do something similar to dump cassandra tables to CSV ... although we use a manifold stream rather than a lazy-seq

dominicm17:08:41

Most of the JSON generators can do this without anything funky. Just point them at a file.

dominicm17:08:02

Or a writer, etc

maleghast16:08:24

Thanks all, I got it working by doing a reduce over the lazy-seq and it's supremely performant, so I am dead chuffed

maleghast16:08:21

like this:

(reduce
     (fn [out v]
       (spit
        out
        v
        :append true)
       out)
     (io/file
      (io/resource "output/output.edn"))
     hotels-with-ids)

maleghast15:08:51

(Can any of you tell that I have not done any real programming for "a while"?)