This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-20
Channels
- # announcements (9)
- # aws-lambda (5)
- # babashka (26)
- # beginners (200)
- # bristol-clojurians (2)
- # calva (74)
- # cider (22)
- # clj-kondo (8)
- # cljsrn (1)
- # clojure (124)
- # clojure-australia (2)
- # clojure-europe (79)
- # clojure-spec (1)
- # clojure-uk (37)
- # clojurescript (87)
- # cloverage (1)
- # code-reviews (10)
- # conjure (41)
- # cursive (5)
- # datahike (2)
- # datascript (3)
- # datomic (11)
- # docker (4)
- # duct (1)
- # emacs (10)
- # events (1)
- # fulcro (3)
- # graalvm (1)
- # honeysql (3)
- # jobs (1)
- # malli (12)
- # meander (51)
- # off-topic (83)
- # pathom (28)
- # quil (3)
- # reagent (19)
- # reitit (3)
- # releases (1)
- # shadow-cljs (49)
- # spacemacs (2)
- # sql (5)
- # startup-in-a-month (1)
- # testing (1)
- # xtdb (8)
Welcome @slack1304 and @seminioni!
thank you @borkdude im newcomer in clojure(script) world, so hope will find a lot of interesting here 🙂
Hi all. Is it possible to extend protocols to clojure maps and functions with bb? I'm having a look at getting tick library working and it does
(extend-protocol Foo
clojure.lang.Fn
...
in a few places@henryw374 Do you have an isolated small example for me?
@henryw374 This works in bb:
(defprotocol Foo
(foo [_]))
(extend-protocol Foo
Number
(foo [x] (prn :x x)))
(foo 1)
But some classes aren't available (yet) which can be potentially fixed in the next version
ok so I found clojure.lang.IFn
is there, so tick could use that instead of clojure.lang.Fn I think, but for maps,
#!/usr/bin/env bb
(defprotocol Foo
(bar [_] ))
(extend-protocol Foo
clojure.lang.IFn
(bar [f] (f))
clojure.lang.APersistentMap
(bar [x] x))
(bar (fn [] "yay!"))
(bar {})
so I guess clojure.lang.APersistentMap
would need adding, unless there's an alternative
@henryw374 This works:
#!/usr/bin/env bb
(defprotocol Foo
(bar [_] ))
(extend-protocol Foo
clojure.lang.IPersistentMap
(bar [x] [:map x])
clojure.lang.IFn
(bar [f] [:fn (f)]))
(prefer-method bar clojure.lang.IPersistentMap clojure.lang.IFn)
(prn (bar (fn [] "yay!")))
(prn (bar {}))
but it leaks the implementation detail that bb uses multi-methods to implement protocols ;Pok, I'll include that in 0.2.7, let me know when you want to release tick for bb, so I can push a new release
Babashka 0.2.7 released We are re-introducing Alpine images along with the main Ubuntu image (thanks @rahul080327) https://hub.docker.com/repository/registry-1.docker.io/babashka/babashka/tags?page=1&ordering=last_updated And various other small improvements (like the one discussed earlier today).
Someone got babashka to work on Raspberry: https://github.com/babashka/babashka/issues/241#issuecomment-763976749
@U3UFFB420 the default rasberry pi OS, or something else like the post?
It's the Raspberry Pi OS, but a 64 bit beta, I downloaded based on what I read https://www.raspberrypi.org/forums/viewtopic.php?t=275370