Are you familiar with core.match? After the core.logic workshop on Wednesday, this looks oddly familiar:
$ ./bb -e "(require '[clojure.core.match :as m]) (m/match (range 100) ([_ _ _ _ & r] :seq) (first r))"
4
$ ./bb -e "(require '[clojure.core.match :as m]) (m/match [0 1 2 3] [0 a 2 b] [a b])"
[1 3]
Well, I know it exists, but not much more than that :) Isn’t that the lib that also allows you to do more advanced pattern matching on fn arts, a la Haskell?
it's basically a more sophisticated case
but I don't think you can use it for defining functions
but you can use it like this:
(defn foo [& args]
(m/match args
[0 1 a] a))
Actually, like this:
(defn foo [& args]
(m/match args
([0 1 a] :seq) a))
Yes, very nice I think. Have you used it “in anger”?
No, I haven't. Just started experimenting with adding it to babashka (because it was requested here https://www.reddit.com/r/Clojure/comments/kyke06/please_vote_if_youre_interested_in_seeing/)
@stefan.van.den.oord This appears to be a nice tutorial: https://blog.klipse.tech/clojure/2016/10/25/core-match.html
Hmm, that site makes your fans spin though
oh boi, I always immediately assume crypto mining when my fans start spinning on a website
That problem has now been fixed btw
Quick reaction by the maintainer
Impressively quick