Fork me on GitHub
#clojure-uk
<
2019-02-28
>
guy08:02:08

morning!

Piotr08:02:40

good day!

dominicm09:02:22

I became aware of reacl recently

guy09:02:27

is this like re-frame? ish?

dominicm09:02:02

I think it fixes some reframe problems, like composition

guy09:02:10

cool il check it out thanks!

dominicm09:02:52

Oh, this is really cool, just figured out the difference in model

dominicm09:02:05

Yeah, this resolves my big complaint with reframe

dominicm09:02:10

Well, one of them

mccraigmccraig09:02:38

what's your big re-frame complaint/s @dominicm ?

mccraigmccraig09:02:51

component composition sure is difficult in re-frame

mccraigmccraig09:02:25

but on the other hand, a single state-store is very nice

dominicm09:02:27

Composition is one of them. Reframe components are far too aware of the shape of the global atom in the name of performance.

alexlynham09:02:03

that’s to be fair true of redux with prop types as well

dominicm09:02:07

I'd rather pass everything down to children, so that I can preview them with devcards.

alexlynham09:02:13

to some extent at least

alexlynham09:02:06

lots of shared knowledge of the shape of the state

dominicm09:02:10

The other thing is that I'm constantly either denormalising my state atom, or writing awkward first/filter stuff. I think datascript as state-atom is the answer here.

dominicm09:02:35

But there's a couple options, like indexed-set

alexlynham09:02:10

> I’m constantly either denormalising my state atom could you explain what you mean by this a little? Not 100% sure that I follow

guy10:02:24

i guess re-frame has a concept of a global state stored in an atom?

guy10:02:03

so to me it sounds like that dominicm would make the data stored in the global state like flatter rather than having nested maps?

guy10:02:07

thats my guess 👀

👍 5
alexlynham10:02:21

I guessed something like that… but I meant more about what use cases/why

5
maleghast10:02:31

Morning All 🙂

👋 10
3Jane12:02:52

Fun fact: today in Poland people celebrate Fat Thursday

3Jane12:02:07

That means you eat as many doughnuts as you want.

3Jane12:02:35

If you have a Polish bakery nearby, go shopping and you will be able to get a large stack of very fresh doughnuts!

😄 8
zyxmn13:02:02

Good God , its true

😂 15
🍩 10
3Jane13:02:09

Lent is coming, people used to use up their lard 🙂

jasonbell13:02:54

Did someone say lard? Yum! 😕

3Jane13:02:56

Note: Polish doughnuts are a bit different from the ones you’re most likely used to, denser, larger, with rose or plum filling and no fancy icing

3Jane13:02:14

And, oh, yeah, traditionally fried in lard because that is actually one of the fats most resistant to high temperatures.

3Jane13:02:37

You wouldn’t want doughnuts fried in burnt fat @jasonbell 😄

3Jane13:02:01

(I think these days professionals use fancy vegetable-based fats, but tradition is tradition)

jasonbell13:02:31

I hard eat doughnuts now @lady3janepl - Best ones I had were in York but since I moved well nothing compares.

3Jane13:02:39

and now, a rendering of Sinead O’Connor by our very own Jason!

jasonbell13:02:38

LOL I can’t sing like that…. or Prince for that matter.

3Jane13:02:52

that makes it even better

5
otfrom14:02:55

I'll do some singing if some is needed. I'll try any song.

3Jane14:02:50

Clojure karaoke

3Jane14:02:00

What goes on between the brackets… stays between the brackets.

otfrom14:02:48

@lady3janepl I believe @jasonbell wishes that were true. My singing escapes.

3Jane14:02:40

your singing is an exception.

3Jane14:02:22

(what am I getting myself into here?!)

jasonbell14:02:38

Well that’s the hornets nest well and truly kicked 🙂

3Jane14:02:44

pulls on Docs just in case

jasonbell14:02:58

Just don’t ask him to sing, it ends badly, that’s all.

3Jane13:02:10

…no, and I’m terrified 😄

guy13:02:30

Theres a place in shoreditch that does them

guy13:02:43

They are tasty in moderation. 👀

otfrom14:02:35

Rinkoff's in Whitechapel does them. I find them a bit much. Fudge donuts in Dundee are good tho. 🙂

alexlynham15:02:34

there’s a couple of places in manchester that do them and I have to restrain myself

😄 10
3Jane13:02:07

The other thing you really want to try is chrust (direct translation, kindling), which apparently is Angel Wings over here https://en.wikipedia.org/wiki/Angel_wings

jasonbell13:02:13

Greggs do Yumyums, near enough to donut goodness for me.

guy13:02:10

Yeah but i wonder if they do cheaper insurance if ur cover only covers doughnut related heart attacks

jasonbell13:02:38

It’s a niche risk, don’t let me dwell on it too long otherwise I’ll make a blog post out of it.

😄 5
zyxmn13:02:37

is it a niche risk really ? 🙂

jasonbell13:02:48

if ur cover only covers doughnut related heart attacks” << this 🙂

😂 5
👌 5
practicalli-johnny13:02:07

what about pepperoni pizza induced heart attacks... pretty sure my risk level is very high after soooo many events 🙂

😂 15
practicalli-johnny13:02:38

@jasonbell I would be much healthier if I didnt have a serious Greggs Cheese n Onion pasty addiction (still strong even after they changed their name to 'bakes'). I used to love the Vegetable pasty even more, then they changed the recipe and I really don't like them now.

jasonbell13:02:56

After years of not having Greggs in Northern Ireland @jr0cket we got them…. Steak “Bakes” were okay but then something changed. So back to Cafe Nero for polite company, non-screaming children and an constantly out of order toilet.

3Jane13:02:30

> constantly out of order toilet

3Jane13:02:39

I mean… that’s a warning sign in a food place, innit

jasonbell13:02:45

yes, its got better recently.

practicalli-johnny13:02:13

Hopefully my "vegan at home" lifestyle will start to un-fur my arteries after all those bakes and pepperoni pizza... may take a decade though 💓

yogidevbear13:02:17

I did the vegan thing for nearly 5 years. I'm making up for lost time now 😉

yogidevbear13:02:19

Morning

👋 10
maleghast13:02:54

I would be vegan, if I could get an exemption for cheese. I am afraid that vegan “cheese” is not ok (for me, other people are welcome to love it) and there is never going to be a vegan alternative to Stilton or Rocquefort that I am ok with… 😞

maleghast13:02:20

I realise that this makes me a bad person(tm) and a failure in the sight of my fellow SJWs, but I am doing my best 😉

maleghast14:02:04

The upside to my failure is that as I won’t do half-measures I can continue to eat bacon and seafood 🙂

maleghast14:02:16

(hey, it’s logical to me__ that’s what counts)

5
guy14:02:34

is being “vegan” like just eating more vegetables for you then 😂

maleghast14:02:02

I’ve adopted a vegan diet in the past, for about 3 weeks all told, I do know what it really__ means.

maleghast14:02:31

I am saying that I would never be able to do it full-time because cheese, specifically Stilton and Rocquefort

maleghast14:02:51

Seeing as I am not even trying, I may as well retain my full-on omnivore credentials.

👍 5
guy14:02:25

i’m just pulling ya leg sorry

maleghast14:02:33

I figured, but it made sense to play along 😉

3Jane14:02:33

@guy don’t pull his leg, if you pull it off, that’ll void your vegan creds

😱 10
Ben Hammond14:02:10

I was having the concept of vegan milk explained to me the other week as coming from a herd where they didn't automatically slaughter the male calves

Ben Hammond14:02:24

which wasn't an angle I've ever heard before

Ben Hammond14:02:55

seems to be an extremely wide variety of opinion about what constitutes 'vegan'

Ben Hammond14:02:05

as in everything, I suppose

zyxmn14:02:07

LOL. This made me cringe

guy14:02:20

i thought vegan milk was just like almond milk / oat milk :thinking_face:

guy14:02:44

almond drink? almond juice?

guy14:02:49

i think milk is the wrong word

zyxmn14:02:04

I thought vegan is no animal products, period.

✔️ 10
guy14:02:10

me too haha

Ben Hammond14:02:44

but fungus is okay ?

Ben Hammond14:02:51

what about slime-molds?

Ben Hammond14:02:53

(I have entamoeba living in my gut. Does that mean I cannot be vegan?)

3Jane14:02:35

plants attempt to defend themselves against eating too.

3Jane14:02:59

to the point of “communicating” with other plants.

zyxmn14:02:16

next stop, cannibalism

Ben Hammond14:02:19

yeah you end up in the Jain predicament of not being able to eat anything with a clear conscience

Ben Hammond14:02:46

I guess a conscience is an analogue thing

3Jane14:02:50

Yeah. Personally before we solve the problem of ethical food, I’d like to solve the problem of everyone having enough food (and housing, and medical care, and safety) please. Because I have a feeling that this will solve ethical food as a byproduct.

✔️ 15
Rachel Westmacott09:03:19

that’s a great angle for ethical consumption, and if you follow it you end up vary close to veganism

3Jane10:03:57

(I agree and) it’s not just what to eat, but who funds it

3Jane10:03:43

I’m most concerned about the perception / treatment of people who don’t add to GDP

Rachel Westmacott15:03:12

A society should be judged by how it treats its least fortunate members.

Rachel Westmacott15:03:34

the very idea of a “person who doesn’t add to GDP” is faintly unpleasant, as if human value can only be measured under a capitalist system in financial terms

3Jane15:03:30

see: the entire discourse around immigrants and NHS.

3Jane15:03:39

it is incredibly unpleasant, and people get vicious and self-righteous around it.

Ben Hammond14:02:02

so it forces you to face up to your life decisions

Ben Hammond14:02:02

trouble is, enough food is a pretty miserable existence

Wes Hall14:02:11

I'm fairly glad I am not vegan. Talked to a lot of these people. Many of them seem to have convinced themselves that humans and non-human animals are entirely equivalent from a perspective of moral consideration. Walking around a supermarket must be like watching all the saw movies at once.

Ben Hammond14:02:24

you want morethan enough ffood, to live comfortably

Ben Hammond14:02:00

well and a Cheetah does not seem overly worried about the rights of the antelope that it just took

3Jane14:02:05

I’m not aspiring to comfort, to begin with. Just, no warzones, no people starving.

3Jane14:02:19

Forces us to come up with an idea of what to do with people who aren’t generating profit.

3Jane14:02:42

(need for profit being a factor in the rise of factory farming)

Ben Hammond14:02:47

Living conditions of farmed animals should be a big consideration

zyxmn14:02:48

Someone ends up paying the price for another's comfort.

3Jane14:02:01

solve that, you influence a lot of other problems.

Wes Hall14:02:28

@ben.hammond I agree with you on that. Actually, once did a fun argument making the case that eating ethically farmed animals was the correct moral choice (over veganism), because if they were not eaten, they would not be farmed and a comfortable existence is morally better than no-existence. I'm super fun at parties btw.

😂 10
Wes Hall14:02:22

Since most of these animals are now human creations, perhaps we have an ethical responsibility to continue their line, and for this, they must pay their way.... by tasting nice after being fried and put inside bread 🙂

Ben Hammond14:02:47

just as we in turn will feed all the wiggly worms

Ben Hammond14:02:11

and so the corkscrew of life keeps churning

3Jane14:02:37

at least they have a greater life purpose than passing butter…

Wes Hall14:02:01

Top reference

guy14:02:11

I’m still waiting for when we start getting cockroach protein bars

Ben Hammond14:02:31

how would you know what's in a tracker bar?

guy14:02:31

Apparently they are the most efficient source of protein

yogidevbear14:02:38

They can also survive a nuclear fallout (apparently). Does that mean I gain the same ability by proxy of eating them? :thinking_face:

guy14:02:09

😂 how would you test it

zyxmn14:02:42

cockroach size nuclear war!

Wes Hall14:02:51

When the cockroaches take over after nuclear war. "Cockroach protein bars, for all your cockroachy needs!"

Ben Hammond14:02:30

see if they can adapt to rising sea levels by learning to swim

guy14:02:41

:thinking_face: i assumed they could swim

guy14:02:19

ah ok they can hold their breath for 40 mins then just crawl around it seems

Wes Hall14:02:28

I need to get back to work... I am supposed to be saving the world, and you guys have got me talking about whether cockroaches can front crawl.

😂 20
Ben Hammond14:02:11

surely those things are connected

Ben Hammond14:02:44

we will create gigantic rafts of tethered cockroaches and build our cities upon them

guy14:02:17

would they still be alive? 😱

3Jane14:02:13

I have tried a cricket brownie

3Jane14:02:15

it was excellent

3Jane14:02:25

would recommend if they still sold it, but alas 😞

yogidevbear14:02:42

Is that like a chocolate brownie that you buy at a cricket match :cricket_bat_and_ball:

guy14:02:46

is that just a brownie with a cricket in it?

Ben Hammond14:02:54

did it chirp when you opened the packet?

3Jane14:02:55

it chirps while you eat it

guy14:02:33

😱😱😱😱😱😱😱😱😱

guy14:02:38

no really?

3Jane14:02:44

I’m pulling your leg

3Jane14:02:51

I’m not vegan so I don’t have to be careful about it!

3Jane14:02:30

Wahaca served them, you got a proper brownie with ice cream

3Jane14:02:34

texture was nice and gooey

3Jane14:02:52

if you concentrated, mayyyybe it was a bit like it was made with fine polenta?

otfrom14:02:53

the only problem w/cricket brownies for omnivores is if you are allergic to shellfish

Ben Hammond14:02:58

what was in the icecream?

otfrom14:02:00

(as you can have the same reaction)

3Jane14:02:16

no, caterpillar goes in the drink (it’s a Mexican chain after all)

otfrom14:02:17

@lady3janepl got my donuts. Paid for 3 minis, got a 4th one free. 🙂

👍 10
😄 5
3Jane14:02:40

yeah, TIL, thank you @otfrom I try to label my baking with allergens, good to know

Ben Hammond14:02:13

is it properly deep-fried in lard?

otfrom14:02:39

@ben.hammond I'm not sure what they fry them in at Clarkie's

otfrom14:02:06

it isn't kosher, halal, or vegetarian tho, so I think they use whatever they like

otfrom14:02:21

(btw if you aren't allergic - chips in peanut oil are the best)

3Jane14:02:45

plantain chips tho?

otfrom14:02:52

@lady3janepl when labelling I'd warn the shellfish people as they often don't know about the insect issue

👍 10
otfrom14:02:07

potato chips (not crisps)

3Jane14:02:31

is it basically that shellfish are insects that we all agreed are not insects and therefore we can eat them?

otfrom14:02:58

possibly. 😉 idk

guy14:02:11

plantain chips are the best its true

Ben Hammond14:02:49

yes, eating prawns is pretty much equivalent to eating crickets

Ben Hammond14:02:22

just glad you don't get grasshoppers the size of a lobster

Ben Hammond14:02:38

glad I'm unaware of it

3Jane14:02:15

I’m not gonna make you aware

👀 4
👁️ 4
😱 4
🙀 4
3Jane14:02:51

psst. look up Japanese cockroaches

3Jane14:02:04

or don’t, if you want to sleep tonight

Ben Hammond15:02:54

I'd call that crayfish sized not lobster size

3Jane15:02:00

scampi are lobsters

3Jane15:02:05

but challenge accepted

3Jane15:02:52

giant weta

😁 5
Ben Hammond16:02:08

haha. so many invertibrates so little time

guy14:02:38

you can get grasshoppers that size?

Ben Hammond14:02:16

my Dad always used to tell me stories about the 'Tanker' mosquito, that could drink a man dry

3Jane14:02:48

…starring Christopher Lee!

Ben Hammond14:02:51

I sorta half believed him for a couple of years

Ben Hammond14:02:08

he was quite reliable about most other things

maleghast15:02:37

Mmmm... Sea insects... Nom nom nom

seancorfield17:02:19

Wow, that's a prize convo this morning... Veganism, insects... Wish I'd been awake sooner 😁

otfrom17:02:03

#clojure-uk resisting being on topic since whenever we started

maleghast17:02:41

I would use #clojure-europe more too, but it's always dead in there... 😞

maleghast17:02:24

I do have an op-topic question... When managing a web-resource that may need to be paginated, how do y'all pass the limit and offset on the URL and how do you handle the differences in your queries?

maleghast17:02:48

(i.e. is there a really Clojuric way to do this?)

3Jane17:02:26

drive by data nerd warning, check for max resource size, offset-based pagination gets really painful for larger datasets

maleghast17:02:33

(I am using postgreSQL and HugSQL, so I am erring on the side of always passing a LIMIT and an OFFSET, just setting them to x & 0 if not supplied - where x=configured number)

maleghast17:02:16

@lady3janepl - I know, I've taken it into account - the use-case is "safe"

👍 5
3Jane17:02:54

(also depending on what you want to cache / allow to be cached, you may want them to be in query vars rather than url)

3Jane17:02:54

but I think your concerns are at a different layer 😄

maleghast17:02:35

They are, I am wondering if passing empty maps is "correct" basically

maleghast17:02:06

FWIW I am using querystring vars as it makes URL matching generic whether they are present or not.

maleghast17:02:56

From inside the let binding on my handler...

options (if (and
                           (not (nil? limit))
                           (not (nil? offset)))
                        {:limit (bigint limit) :offset (bigint offset)}
                        {})

seancorfield17:02:08

We tend to pass page number (1, 2, 3, ...) and page size (default to, say, 15, but can be overridden by client). We validate those params are reasonable, then convert to limit/offset in MySQL.

mccraigmccraig19:02:56

another alternative (our db doesn't support offset) is to use > or < and limit

mccraigmccraig19:02:33

it works very well for infinite scrolls

practicalli-johnny20:02:55

What are your preferred ways of consuming API's, either sever or client (ClojureScript) side. Looking for ideas for the weekly Clojure study group. I'm starting off with a simple JSON API, but will be consuming more interesting APIs soon. Do you just use slurp or http-kit clj-http for simple Api's? Any neat little libraries lik https://github.com/Raynes/tentacles? Anthing CLJS specific, like cljs-ajax or websockets stuff Are you using Cheshire (JSON) or Transit (many things) to manage transformation of formats? Or do you just drop all the data as a nice Clojure map onto a Kafka topic? Perhaps with some relatively simple ingestion scripts/tools. Interested in understanding what people are using and why. Thanks.

guy21:02:39

For my personal use: I use http-kit for client stuff I use cheshire for json stuff I do edn / json /avro on a kafka topic. I use spec for validation on boundaries, e.g (s/valid? ...). As to why? http-kit, i think i just found it easier to understand when i first started clojure. So no real reason 🤷 . I like cheshire simply because i can do true for converting json to keywords. (parse-string "{\"foo\":\"bar\"}" true) and that covers most cases 😂 . I use json for very raw data, edn for internal data and avro for data other people outside my team are gonna read. I use spec, partly because i’m still trying to get my head around it and I never really liked schema. Hope that helps :thumbsup:

👍 5
alexlynham09:03:59

JSON all the time and jsonista for serialisation

practicalli-johnny20:02:06

Also interested in knowing if you are managing data to or from API's with Spec, Plumatic schema or other libraries. Thanks

alexlynham09:03:42

schema and swagger auto generated from that FTW

seancorfield20:02:17

Mostly clj-http right now but we're shifting to http-kit. We're using Cheshire for JSON (`clj-http`'s default, and as a callback for http-kit). For the most part, where we're consuming APIs, we're doing something synchronous, to get some specific data to process right there and then.

seancorfield20:02:05

We don't (currently) use Spec around APIs we consume -- we do use it around APIs we expose to clients.

dominicm20:02:56

Why are you moving away from clj http?

seancorfield21:02:28

We've run into bugs with the version we're using, and more recent versions break our code in some weird way that we just gave up debugging after seeing that it worked just fine with http-kit instead.

seancorfield21:02:41

Also, we have places where we need an async call that we can cancel/timeout which did not seem possible with clj-http (or, at least, not with any version that actually works with our code).

seancorfield21:02:05

And, to be honest, clj-http seems to be a bit kitchen-sink-y for a Clojure library at this point.

seancorfield21:02:38

I'm a big fan of "simple" and clj-http is far beyond simple at this point, even tho' it is mostly "easy".

mccraigmccraig21:02:10

HTTP client - clj: aleph, cljs: goog.net.XhrIo. JSON - clj: cheshire , cljs: js/JSON. websockets: cljs: jarohen/chord, promises - clj: manifold/deferred, cljs: promesa, promise composition - clj: cats/mlet + cats.labs.manifold, cljs: cats/mlet + cats.labs.promise... we use mostly JSON for APIs for interop with non-clj universe (although we do use EDN and transit in different contexts), schema for API validation and JSON coercion on both ends of the wire (not spec, thanks to yada and history)

seancorfield21:02:26

@mccraigmccraig I haven't looked at manifold/deferred -- what does it add over the built-in promise?

mccraigmccraig21:02:31

everything @seancorfield 😁 built-in promise has no completion callbacks so doesn't compose, so is no use for building non-blocking systems

seancorfield22:02:31

There's a CLJ JIRA ticket for that and it's been triaged so may be on the list for 1.11 🙂

seancorfield22:02:01

(I told Alex recently it was one of my top three "wants" for 1.11)

seancorfield22:02:14

Yeah, fingers crossed 🙂

seancorfield22:02:07

There are 65 issues slated for 1.11 so far so... ¯\(ツ)

seancorfield22:02:19

(and two slated for 1.10.1)

mccraigmccraig22:02:45

could be nice - manifold deferreds are pretty cool though - they interact very nicely with manifold streams and core.async and give you fine control of the underlying j.u.c executor if you need it

dominicm23:02:02

@seancorfield fwiw, aleph is a drop in replacement for clj http that is async

seancorfield23:02:18

I suspect it would conflict with a different version of Netty that we're already using... looking its project.clj file.

seancorfield23:02:20

We've had a lot of problems with compatibility across different versions of Netty. It seems really fragile.

mccraigmccraig23:02:51

yeah, true - netty is famously version fragile. we've got two different versions of it in our api which is only sane because one of them is shadowed