clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
slipset 2020-10-27T07:40:42.408500Z

I've been wondering why core has all these fns like interleave, interpose and other neat sequence functions. To me they seemed, well, neat, but nothing I ever reach for in my day to day work. But then I tried to write a macro, and they made a lot more sense.

slipset 2020-10-27T07:50:19.408700Z

Oh, and good morning!

javahippie 2020-10-27T07:59:32.409Z

Morgen

dominicm 2020-10-27T08:06:15.409200Z

Morning

orestis 2020-10-27T08:15:49.409400Z

Morning

dharrigan 2020-10-27T08:18:45.409600Z

Dia Duit!

mpenet 2020-10-27T08:22:53.411500Z

I used interpose a lot in the past, it's great to generate token (comma, AND, OR etc) separated strings and since it has a transducer arity you can compose with it nicely and "realize" the final thing with a single call to transduce + a string-builder reducing fn

mpenet 2020-10-27T08:23:21.412Z

(ex context clojure dsl -> some string based query language)

mpenet 2020-10-27T08:26:14.413900Z

You can do the same with str/join but you loose the ability to do it in a single pass when you need to also work on the values passed to it, think (str/join "," (map tranform xs)) vs (transduce xform string-builder xs), where string-builder and xform can be heavily optimized for what you need to generate

2020-10-27T08:36:20.414100Z

Morning

borkdude 2020-10-27T08:37:28.415400Z

I needed interleave to process namespace forms and interleave the namespace names with :reload, so you get:

(ns foo (:require [foo :as f] bar)
=>
(ns foo (:require foo :reload bar :reload)

ordnungswidrig 2020-10-27T08:50:46.415600Z

Good morning!

plexus 2020-10-27T08:51:44.415800Z

good morning!

2020-10-27T10:18:36.416500Z

šŸ‘‹ @web20

šŸ™Œ 1
synthomat 2020-10-27T10:19:38.416700Z

morning!

raymcdermott 2020-10-27T13:05:13.416900Z

morning

slipset 2020-10-27T14:31:39.417500Z

Another one of those things that feel ok to discuss in here.

user> (= 1 1 1)
;; => true
user> (= 1 1)
;; => true
user> (= 1)
;; => true
user> (=)
Execution error (ArityException) at user/eval73949683 (form-init4579255747461836344.clj:2764).
Wrong number of args (0) passed to: clojure.core/=

slipset 2020-10-27T14:32:06.418Z

this blows up when you do (apply = xs) and xs is empty

slipset 2020-10-27T14:33:38.418700Z

(= nil) => true

borkdude 2020-10-27T14:34:45.419100Z

true yes, I've had that exception as well

borkdude 2020-10-27T14:35:03.419500Z

maybe this is like (-) because = doesn't have an identity element?

slipset 2020-10-27T14:35:36.420Z

Could be, but it also seems like < and > behaves this way.

slipset 2020-10-27T14:36:10.420700Z

I guess this is somewhat violating the principle of least surprise.

slipset 2020-10-27T14:37:09.421900Z

I think I'd be happy if = was two-arity, I'm pleasantly surprised by it being multi-arity, but then again, a bit annoyed that it's not zero-arity.

borkdude 2020-10-27T14:39:20.422300Z

I'm sure there's a reason it doesn't return true or false by default

borkdude 2020-10-27T14:39:41.422700Z

one thing is equal to itself. but zero things...?

borkdude 2020-10-27T14:39:58.422900Z

undefined I would say

slipset 2020-10-27T14:42:19.423600Z

Am I equal?

thomas 2020-10-27T14:43:32.423900Z

morning

borkdude 2020-10-27T14:43:37.424100Z

lol

slipset 2020-10-27T14:43:44.424400Z

user> (< 3)
;; => true
user> 

slipset 2020-10-27T14:43:53.424700Z

Don't know if that makes sense?

borkdude 2020-10-27T14:44:31.425200Z

(> 3)
true
hmm, 3 is both smaller and greater than... something

slipset 2020-10-27T14:44:57.425600Z

user> (= 3)
;; => true
user> 

slipset 2020-10-27T14:45:11.426100Z

user> (not= 3)
;; => false
user> 

mpenet 2020-10-27T14:45:16.426200Z

(and) the universal truth

slipset 2020-10-27T14:45:43.426700Z

This is so disturbing I might have to move on to Haskell or Idris or somehting.

borkdude 2020-10-27T14:46:14.427300Z

@slipset We can make a clj-kondo rule that says: don't use varargs comparison: always use reduce + an explicit identity ;)

slipset 2020-10-27T14:47:28.428700Z

I guess this is the kind of runtime errors I have a hard time accepting, And why I now always use the three-arity reduce

slipset 2020-10-27T14:48:32.429800Z

I can handle (runtime) type-errors as they don't crop up too often, but runtime-lack-of-nil-punning sucks.

slipset 2020-10-27T14:48:54.430300Z

Same difference when using clojure.string I guess

borkdude 2020-10-27T14:49:18.430700Z

lack of zero-arity isn't the same as nil-punning though

borkdude 2020-10-27T14:49:37.431200Z

I would say an error is better than silently returning true of false here

borkdude 2020-10-27T14:50:13.432300Z

(when (seq things) (apply = things)), it's a bit annoying

slipset 2020-10-27T14:50:33.432600Z

And Zach thinks (get nil :foo) should be error as well.

borkdude 2020-10-27T14:50:47.432800Z

What about (:foo nil)

slipset 2020-10-27T14:51:13.433300Z

https://www.youtube.com/watch?v=pWdd6_ZxX8c šŸ™‚

slipset 2020-10-27T14:52:16.434500Z

You could argue that map lookups should always be done with a sentinel-value

(:foo nil :not-found)

borkdude 2020-10-27T14:52:50.435300Z

or: (or (:foo nil) (throw (ex-info "up" {}))))))))

borkdude 2020-10-27T14:53:05.436Z

(I didn't know how many closing parens I should type, so I just ensured there were enough)

slipset 2020-10-27T14:53:11.436200Z

I guess what Zach argues is that when you to a map-lookup on nil you change the type of nil, if that makes sense.

slipset 2020-10-27T14:53:44.436900Z

(:foo nil :not-found) is supported in Clojure BTW

borkdude 2020-10-27T14:53:44.437Z

ok let me know how it goes in Haskell land and see you back in a year or two :)

slipset 2020-10-27T14:53:59.437200Z

rofl

2020-10-27T15:00:10.437800Z

< and > aren't less-than or greater-than, they are increasing and decreasing (or at least that is the only way I can remember

1
orestis 2020-10-27T15:02:10.438600Z

I just saw an AWS update that Corretto JDK 11 now supports Shenandoah GC, and it turns out it was backported to JDK11. I wonder if someone has used it with Clojure programs and has any experience report?

2020-10-27T15:04:49.438900Z

I'd certainly be up for any GC/jvm tuning tips

2020-10-27T15:06:14.439100Z

I suppose there is this: http://clojure-goes-fast.com/blog/shenandoah-in-production/

borkdude 2020-10-27T15:43:09.439500Z

@otfrom Yeah, the docstring says so. That would explain the behavior or (&lt; 3)

borkdude 2020-10-27T15:43:10.439700Z

<3

1
plexus 2020-10-27T16:07:33.439800Z

still waiting for someone to release a fork of clojure.string that nil-puns

dominicm 2020-10-27T20:01:17.440500Z

Totally unrelated, http://mailbox.org looks great

borkdude 2020-10-27T20:50:45.440800Z

Yep, I moved to that and I'm pretty happy with that so far

synthomat 2020-10-27T23:17:52.442800Z

How accurate is the spam filtering? I suffer from an increasing amount of spam mails in my inbox and now Iā€™m thinking about rolling my own mail setup (again) :white_frowning_face: