Fork me on GitHub
#clojure
<
2023-06-12
>
Daniel Tan08:06:25

do sequences also happen to be monads?

delaguardo09:06:42

No. What makes you think that?

Colin (fosskers)09:06:03

Check out Transducers if you're interested in generalised iteration over many different source/container types

Daniel Tan09:06:34

@U04V4KLKC from what i understand seq are functors which also fulfill the monadic laws via `map` and `mapcat`

👍 2
hansbugge09:06:03

Sequences can be monads if you say they denote finite lists. The same goes for any other list-like type such as vectors, arrays, lists. You can check that you can define `unit` and `join` and verify the monad laws (https://en.m.wikibooks.org/wiki/Haskell/Category_theory). The list monad is what academics would say is useful for modelling non-determinism. Software engineers would probably think of it as “list comprehension” instead. `for` in Clojure is for example an implementation of syntactic sugar for monadic bind for the list monad. Whether this is useful knowledge, I couldn’t say.

👍 4
Ed09:06:21

Sequences are not monads in and of themselves, but can be used "monadicly" with some discipline. But this doesn't really make much sense in the context of Clojure. Monads seem to me to be an attempt to classify the work that's being done by your program to make it easier to enforce restrictions on that work statically. Clojure focuses on making it as easy as possible to run your code at the REPL. This is kind of at odds with the idea static enforcement.

potetm11:06:29

They are monad values, but clojure has no monad functions for composing them.

valerauko09:06:29

I was wondering if there's any progress I might've missed wrt varargs? like https://clojure.atlassian.net/browse/CLJ-440

Alex Miller (Clojure team)12:06:37

It’s in scope for 1.12 but we haven’t worked on it much yet

valerauko13:06:06

I hope it makes it to 1.12! It'd be a huge QOL improvement for interop with certain libraries that use a lot of varargs ❤️

fabrao11:06:09

Hello all, I saw today this nvd -> ageneau.utils-0.1.1.jar - CVE-2023-2972, but CVE-2023-2972 is related to npm package antfu/utils. Is it a false positive?

p-himik12:06:30

Yes.

👍 2