Fork me on GitHub
#clojure-uk
<
2018-03-13
>
thomas08:03:25

moin moin morning

guy08:03:30

morning!

maleghast10:03:18

Morning everybody 🙂

Amelia10:03:33

Are there any Clojure groups or events outside London, as a general rule? I’m moving back to Hampshire in a couple of weeks and wondering if there’ll be anything I can attend closer to home.

yogidevbear10:03:55

Hi @amelia We have an FP meetup in Horsham (West Sussex). Might be a little to far depending on where in Hampshire you're moving to.

Amelia10:03:21

Unfortunately it looks like my route there would be via London! Thank you though, still good to know. 🙂

otfrom10:03:34

@amelia there are some in Bristol

otfrom10:03:58

@thomas might know about some in Hampshire

thomas11:03:58

@otfrom @amelia there is/was a FP group in so'ton, but no idea what happened to that one.

thomas11:03:25

@keithmantell do you know of any Clojure/FP meet up in Hants?

Rachel Westmacott11:03:43

Does anyone know why some functions have an asterisk on the end? eg. [clojure|cljs].core/inst-ms*

sundarj11:03:39

@peterwestmacott it's a naming convention for when you want to give something the same name as something else. it's often used for functions that are for the internals of a macro with the same name

Rachel Westmacott11:03:18

okay, thanks. I’ve always used name' for that, but I can see that makes sense with other core fns.

sundarj11:03:52

i think the classical use of name' is for when you've changed something slightly 😛

sundarj11:03:32

e.g. (let [name "bob" name' (str/upper-case name) name'' (str/lower-case name')])

Rachel Westmacott11:03:43

okay, so name' for slightly different nouns and name* for slightly different / internal implementation verbs?

sundarj11:03:15

i first read about the apostrophe thing in LYAH: https://i.imgur.com/O1Htge0.png

sundarj11:03:28

think it comes from maths

sundarj11:03:09

and IIRC, Clojure previously didn't allow apostrophes in symbol names, but it was added because of this convention

Rachel Westmacott11:03:29

yes, I’ve seen it in other code, and I think familiarity from mathematics has led me to copy that convention

sundarj11:03:17

fair enough 🙂

sundarj11:03:20

that makes sense to me

jasonbell11:03:22

@amelia I hang around with this wonderful lot and listen, I can't make any meetups either. 😞

Amelia11:03:19

I can make them! I won’t be too far from London, just trying to figure out how best to allocate my travel budget. 🙂 The more I can make the better, I know…

jasonbell11:03:04

Oh excellent!

Rachel Westmacott11:03:51

@jasonbell is there some kind of remote meetup?

Rachel Westmacott11:03:57

Also: does anyone know a consistent way to hash arbitrary nested data structures across Clj / Cljs ?

jasonbell11:03:01

@peterwestmacott Yeah it's me weeping in a skip with a copy of Clojure for the Brave and True 🙂

Rachel Westmacott11:03:58

@jasonbell if we want to join in do we just weep empathetically in our own skips?

jasonbell11:03:37

The skip is optional

Rachel Westmacott11:03:47

I might skip the skip then.

otfrom12:03:56

@peterwestmacott there was some talk on hashing on this channel a few weeks ago from @mccraigmccraig and others IIRC

otfrom12:03:02

I think @maleghast was asking

jasonbell12:03:51

we did a remote a while ago, that was nice, so it would be nice do something proper

mccraigmccraig12:03:11

i don't recall that @otfrom (which doesn't mean it didn't happen)

maleghast12:03:24

@otfrom - I am also not sure that I was involved in that conversation...

otfrom12:03:32

I might be confusing this with uuids...

otfrom12:03:38

b/c I'm a numpty

mccraigmccraig12:03:35

ah, i remember a hierarchic uuid discussion

mccraigmccraig12:03:56

which is a hashing related thing

keithmantell13:03:12

Hi, no - had a quick look - some Elixir in Southampton.....

keithmantell14:03:34

I think remote meetups are probably the way forward! I can come up to London but seem to go there rarely on business these days

maleghast14:03:37

@mccraigmccraig - Just wanted to say "Thanks!" re throttler - absolute perfection! 🙂

thomas16:03:17

Has Javascript been designed to make sure that the little time you have on a project is wasted on chasing problems not at all related to the actual problem you are trying to solve :thinking_face:

sundarj16:03:57

pretty much

thomas16:03:30

certainly feels like it.... 😞

sundarj16:03:32

it even affects the people steering the language: https://github.com/tc39/proposal-flatMap/pull/56

maleghast16:03:53

Just wanted to also mention that the fact that

(compare x y)
just works with clojure.instance values is one of the reasons that I will forever love this language.

Rachel Westmacott09:03:55

What are “clojure.instance values”? (I may be being dumb here.)

maleghast14:03:07

Since Clojure 1.8 you can have literals that are treated as java.time dates / datetimes:

#inst "2018-03-14T14:00:00.000000000-00:00"

maleghast14:03:31

you can quickly read text-based date-times into java.date objects using the namespace, thus:

(clojure.instant/read-instant-timestamp "2018-03-14T14:00:00:00Z")

maleghast14:03:54

If you want to compare two java.date values that you've "got" by using this approach you can just do this:

(compare #inst "2018-03-14T14:00:00" #inst "2018-03-14T13:59:00")
and that should evaluate to 1 meaning that he first date is "greater than" (or in date terms more recent) than the second.

maleghast14:03:32

So, in my code that I am working on at the moment, I get a string date from the API I am interacting with, I turn it into a java.date with instant/instant-read-timestamp, and then I can compare it with another date value similarly created from string beginnings and it "just works". I don't have to convert to UNIX timestamp and do a mathematical comparison, I just "compare" two dates and Clojure / Java can handle the rest for me.

maleghast14:03:35

I like that.

maleghast15:03:03

I just discovered something that actually makes this slightly less useful and / or good... The underlying type of the result of clojure.instant/instant-read-timestamp is actually java.sql.Timestamp, not java.time datetime which makes them less useful in some ways...

maleghast15:03:34

However, @U050CTFRT / Juxt's library tick represents a soplid alternative.

maleghast15:03:05

and values from tick timelines can be compared using compare in the same way.