clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
2020-11-08T08:07:04.223800Z

Morning

dominicm 2020-11-08T08:40:52.224Z

Morning

synthomat 2020-11-08T08:43:44.224200Z

morning!

borkdude 2020-11-08T10:33:02.224400Z

Babashka survey: https://nl.surveymonkey.com/r/H2HK3RC

pez 2020-11-08T10:42:19.225200Z

Good morning! I'm trying to understand why

(reduce str "1") => \1

jasonbell 2020-11-08T11:43:41.226100Z

Morning

borkdude 2020-11-08T11:53:56.226400Z

That's weird. But (reduce str "" "1") does work. Btw, (apply str ...) might be better so there's only one StringBuilder

2020-11-08T12:08:09.226700Z

is it going to assume that the string is a seq of characters?

slipset 2020-11-08T12:10:18.228600Z

I think you’re seeing a couple of things. If I remember correctly, reduce will not invoke the reducing fn if there is only one element in the list

slipset 2020-11-08T12:11:01.230100Z

And, as discussed previously, a string is considered a sea of chars, as @otfrom points lit

borkdude 2020-11-08T12:11:17.230500Z

@slipset You're correct.

(reduce - [1])
1

slipset 2020-11-08T12:12:32.232400Z

There is a mailing list entry (or something) somewhere where Rich regrets the two arity version of reduce for several reasons.

borkdude 2020-11-08T12:12:51.232600Z

Could make a clj-kondo rule for this: always provide an identity element

borkdude 2020-11-08T12:13:16.233300Z

If you could point me to the Rich entry on this, could post it in an issue

borkdude 2020-11-08T12:14:45.234Z

thanks!

pez 2020-11-08T15:02:37.235800Z

Thanks. I didn't run into trouble with this. I was just trying to understand reduce a bit better and one of my experiments gave me that funny result.

val_waeselynck 2020-11-08T15:17:43.236Z

Hint: the other name for String is CharSequence ;) and reduce with this arity assumes that an element combined to no other reduces to itself.

👍 1
borkdude 2020-11-08T16:26:44.236200Z

https://github.com/borkdude/clj-kondo/issues/1064

2020-11-08T17:37:00.237Z

anyone here had a play with flow-storm-debugger? https://github.com/jpmonettas/flow-storm-debugger