Fork me on GitHub
#clojure-uk
<
2018-11-27
>
thomas08:11:13

mogge 😼

yogidevbear09:11:44

:yawn: Morning πŸ˜ͺ

yogidevbear11:11:36

Feeling a little run down. Year end activities πŸ™‚

jasonbell09:11:50

Morning friends

agile_geek09:11:13

Bore da pawb welsh_flag

jasonbell10:11:17

Nearly got my ClojureX slides done, just a few bits to tighten.

πŸ‘ 8
thomas10:11:14

@jasonbell can I get a preview?

thomas10:11:35

just to prepare me...

jasonbell10:11:10

nope

πŸ˜‚ 4
jasonbell10:11:44

There’s no way I’m giving you a heckling headstart @thomas

alexlynham10:11:54

"boo kafka, boo python, that concludes my presentation, thank you everybody for coming"

alexlynham10:11:13

puts up slide that just says trollface

jasonbell10:11:37

And the title of my talk is @alex.lynham? πŸ™‚

alexlynham11:11:17

πŸŽ‰ πŸ’¨γ€°οΈ clj🧠troll

alexlynham11:11:30

that's my best emoji rendition of deep learning with kafka and clj, haha

jasonbell11:11:40

Not bad πŸ™‚

danm11:11:18

Anyone got dynamodb querying fu here?

folcon13:11:19

Morning :)…

mccraigmccraig14:11:59

i've got c* query-fu @carr0t... which may or may not be applicable, depending - what's your problem ?

danm14:11:07

I've got a load of data in a DDB, and some of the import was corrupt, but I don't know which bits

danm14:11:22

I know the effect, which is that a partition key in DDB will be missing a certain record

danm14:11:37

With the key 'entity-type' set to the value 'version'

danm14:11:51

So I want to return all partition keys which don't have a 'version' record

mccraigmccraig14:11:57

is the table moderate sized enough that you can do a full-table scan ?

mccraigmccraig14:11:16

that would be my first port of call for a similar c* problem

mccraigmccraig14:11:12

hmm - and even to build an index table of rows which don't have a particular attribute would require a full-table scan anyway, certainly in c*

danm14:11:10

S'OK, we think we've got a halfway house that won't necessarily fix all the data, but it'll fix the bits we care about πŸ˜‰

mattford14:11:10

Hey now, hey now, don't dream....

mattford14:11:24

But (+) is 0

mattford14:11:49

Yet (-) is not defined.

mattford14:11:20

Kind of wanted the minus to have an identity. And I'm suprised it doesn't seem to.

mattford14:11:28

Anyone know why?

jasonbell14:11:26

user=> (doc -)
-------------------------
clojure.core/-
([x] [x y] [x y & more])
  If no ys are supplied, returns the negation of x, else subtracts
  the ys from x and returns the result. Does not auto-promote
  longs, will throw on overflow. See also: -'
nil
user=> (doc +)
-------------------------
clojure.core/+
([] [x] [x y] [x y & more])
  Returns the sum of nums. (+) returns 0. Does not auto-promote
  longs, will throw on overflow. See also: +'
nil

jasonbell14:11:34

Interesting.

Conor14:11:13

Probably because subtraction isn't commutative?

mattford14:11:34

true, but zero is still the identity

mattford14:11:09

(defn vector_arith [f]
  (fn
    ([]            [(f) (f)])
    ([[x y]]       [(f x (f)) (f x (f))])       
    ([[x y] [a b]] [(f x a) (f y b)])
    ))

mattford14:11:43

I wanted to be able to pass in - or + to convert them to work over vectors

mccraigmccraig15:11:40

given that - works on any arity >=1 and there is an identity it would seem reasonable for it to also work with arity 0

bronsa15:11:11

0 is the right identity of -, but it's not its identity

bronsa15:11:27

>Let (S,β€‰βˆ—) be a set S with a binary operation βˆ— on it. Then an element e of S is called a left identity if e βˆ— a = a for all a in S, and a right identity if a βˆ— e = a for all a in S. If e is both a left identity and a right identity, then it is called a two-sided identity, or simply an identity.

mattford15:11:06

(transduce identity + [1 2 3])
6
witan.send.model.run> (transduce identity - [1 2 3])
ArityException Wrong number of args (0) passed to: core/-  clojure.lang.AFn.throwArity (AFn.java:429)

mattford15:11:14

a bit annoying

bronsa15:11:08

user=> (transduce identity - 0 [1 2 3])
6

mattford15:11:27

yeah but I now need to know the identity

mattford15:11:36

or not the identity πŸ™‚

mattford15:11:41

the right-identity

bronsa15:11:52

we can't change how maths work in order to make a particular use-case more ergonomic :)

truestory 8
mattford15:11:47

can it be the case that we use the right-identity for clojure though?

bronsa15:11:07

transduce does

bronsa15:11:12

that's a particular use-case

minimal15:11:19

as long as you don’t call it a monoid

bronsa15:11:26

if you were to fold right instead of left it would be broken

mattford15:11:57

Cheers, back to work.

bronsa15:11:08

(actually it's the other way round)

minimal15:11:14

you can put your function in to test check to check if it passes the laws https://gist.github.com/minimal/40085951c277d8ce26ad

parrot 4
bronsa15:11:34

transduce would need the left identity

thomas15:11:46

@bronsa... surely changing math just requires a PR?

simple_smile 4
bronsa15:11:49

which doesn't exist for - !

thomas15:11:52

πŸšͺ πŸƒ

otfrom15:11:54

@minimal I like that monoid checker πŸ™‚

otfrom15:11:21

monoids are really useful

minimal15:11:41

thanks, I think I probably stole the initial check from somewhere and added to it