Fork me on GitHub
#clojure-uk
<
2019-04-08
>
thomas07:04:22

moring lovely people!

alexlynham08:04:43

morning morning

otfrom09:04:02

morning from a grey London

maleghast09:04:35

Good morning All - London is not delivering this morning, huh?

jasonbell09:04:08

Sunny in NI. Get book proposal out of the door. All good fun.

dominicm09:04:37

I've not brought a coat in MK, regretting it.

3Jane09:04:34

the benefit of fog in London on Monday is that you can’t see where you’re going

3Jane09:04:39

which means you can’t see that you’re going to work

3Jane09:04:47

which means the Sunday-Monday transition is less painful.

😂 8
maleghast09:04:06

@lady3janepl - I applaud your approach, but my brain does not work like that... Also fog in London on a Monday morning means that my flight is delayed in leaving Glasgow (as it was today) so that's a bummer for me too.

agile_geek10:04:58

the benefit of WFH is that your commute is very short (about 4m in my case) and fog is not usually an issue, but the disadvantage is you have to be disciplined about when you are at work and when you're not!

thomas10:04:03

just remember... Monday lunchtime is furthest away from the next Monday morning...

mario-star 4
maleghast10:04:31

Quick interop question... If I want:

import gov.nasa.worldwind.geom.Angle;
import gov.nasa.worldwind.geom.coords.MGRSCoord

maleghast10:04:28

do I add all of:

gov.nasa.worldwind
as a dependency to the app and then import the bits I need?

jasonbell10:04:26

(:import [gov.nasa.worldwind.geom Angle]
                   [gov.nasa.worldwind.geom.coords MGRSCoord])
I’d just keep what you actually need.

jasonbell10:04:14

I’m quite pragmatic when it comes to imports @maleghast

maleghast10:04:57

@jasonbell - ok, but don't I need to declare a dependecy in the project aswell?

jasonbell10:04:21

Yeah you’ll need the jar reference in the deps too.

jasonbell10:04:28

Is the library on maven?

jasonbell10:04:59

;; 
[gov.nasa/worldwind "2.0.0-986"]

maleghast10:04:51

🙂 Sweet, thanks 🙂

maleghast10:04:45

Last thing... Any pointers on "how to write a Clojure Library that wraps up Java stuff?"

maleghast10:04:13

(I've never written a library, but this looks like a great candidate)

jasonbell10:04:15

Shiv the Java stuff in a java-src folder and point to it in the project.clj file.

maleghast10:04:30

tools-deps approach..?

jasonbell10:04:38

Then I’d write a namespace to call the Java code. Did it quite a few times on previous projects.

jasonbell10:04:58

There are times it’s not worth reinventing the wheel when a quick Java shiv will do fine.

jasonbell10:04:25

Especially with libraries where there are well used Java examples. I’d use them and just send the require args data in.

maleghast10:04:38

I don't really understand...

jasonbell10:04:57

From the school of “just get it working” and not fret about the beauty of it all. Happy chat it through @maleghast if you wish.

maleghast10:04:08

Surely libraries can have deps - why do I need to copy the jar(s) into my project?

jasonbell10:04:32

The deps should get pulled in too, that’s the point we tend to learn by doing 🙂

guy12:04:20

Clojure function that i found out about today: https://clojuredocs.org/clojure.core/find

(find {:a 1 :b 2 :c 3} :a)
;;=> [:a 1]
Returns a map entry :thumbsup: You can call val on it i think :thinking_face:

minimal12:04:36

good with (if-let [[_ v] ...) if your values can be nil, so you don’t need to use contains?

👍 12
guy13:04:03

Also what do you folks think about: vec vs (into [] ..)

jasonbell13:04:05

With clojure.data.csv I’ll use them both @guy 🙂

👍 4
jasonbell13:04:29

Or just mapv 🙂

☝️ 8
otfrom13:04:13

@guy depends on what you are doing. I ❤️ using (into [] ,,,) with a transducer

guy13:04:09

yeah me too haha 😄

dominicm14:04:06

find pairs well with things like some to find not only the value which matched, but the key too

jasonbell15:04:13

Proposal away, looks more like a rewrite than a second edition.

jasonbell15:04:31

Well I wasn’t expecting that…

3Jane16:04:21

obligatory http://diggercomic.com/ recommendation for people who haven’t seen it yet 😄