This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-17
Channels
- # babashka (4)
- # beginners (161)
- # calva (19)
- # cider (13)
- # circleci (16)
- # clj-kondo (7)
- # cljs-dev (3)
- # cljsrn (46)
- # clojure (105)
- # clojure-australia (2)
- # clojure-nl (15)
- # clojurescript (20)
- # conjure (14)
- # core-async (8)
- # cursive (3)
- # datomic (4)
- # figwheel (5)
- # fulcro (22)
- # graalvm (1)
- # hoplon (2)
- # kaocha (3)
- # leiningen (6)
- # malli (5)
- # off-topic (19)
- # re-frame (5)
- # reagent (1)
- # reitit (43)
- # releases (1)
- # reveal (14)
- # rewrite-clj (2)
- # rum (1)
- # shadow-cljs (31)
- # spacemacs (2)
- # sql (6)
- # xtdb (8)
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
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