This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-01
Channels
- # announcements (23)
- # babashka (66)
- # babashka-sci-dev (7)
- # beginners (24)
- # biff (2)
- # calva (19)
- # cider (10)
- # clj-kondo (12)
- # cljs-dev (3)
- # cljsrn (2)
- # clojure (37)
- # clojure-art (1)
- # clojure-europe (50)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (22)
- # clojure-uk (7)
- # clojurescript (6)
- # conjure (28)
- # cursive (19)
- # data-science (11)
- # fulcro (21)
- # holy-lambda (12)
- # honeysql (6)
- # hyperfiddle (2)
- # jobs (1)
- # lsp (5)
- # malli (4)
- # meander (3)
- # missionary (8)
- # nbb (5)
- # off-topic (39)
- # rdf (9)
- # reitit (1)
- # releases (1)
- # sci (21)
- # shadow-cljs (42)
- # specter (1)
- # xtdb (11)
https://github.com/tgk/plait 0.0.1 is out. It is a wrapper around let
which allows you to redeclare previous bindings and for those new declarations trickle through to the rest of your plait
bindings. It is designed to making the declaration of repetitive test setup-code easier to write, read, and maintain - think rspec
from Ruby but with less magic. We have used it at GoMore for a while now in our test code and are very happy with how it has allowed us to keep the test code shorter and easier to read.
This is an interesting idea. IIUC current implementation implies bindings are evaluated once per plait
instance, right? Like:
(plait [a (do (prn "a evaluated") 1)
b (inc a)]
(plait [b (+ 2 a)])) ;; 3
;; Prints
;; "a evaluated"
;; "a evaluated"
This is correct! We haven't had the use case yet but you could even use it to trigger an extra evaluation by passing the empty vector (plait [] ...)
Another thing worth mentioning is that all bindings need to be declared at the top level. This to make the ordering explicit.
Do you have the opposite use case? Eval bindings the minimum amount of times. Like statically tracking symbol usage to prune unused bindings and avoid binding repetition when an ancestor is shared:
(plait [a (do (prn "a evaluated") 1) ; a has 2 children
b (prn "b shadowed " (inc a)) ; b is shadowed, no need to run (inc a)
]
(plait [b (+ 2 a)]
(prn "b " b) ; b must be evaluated here, so a must be too
)
(plait [b (+ 3 a)]
(prn "b " b) ; b must be evaluated here, a is already evaluated
))
;; Prints
;; "a evaluated"
;; "b 3"
;; "b 4"
;; (do (prn "a evaluated" 1)
;; -----------------------
;; |
;; a
;; |\
;; / \_
;; / \
;; (+ 2 a) (+ 3 a)
;; ------ ------
;; | |
;; b b
;; | \
;; | |
;; (prn "b " b) (prn "b " b)
Ah no! That would be more in line with rspec
from Ruby where a traversal of the directed acyclical graph means only the minimum code is called. We also experimented with this approach but were unable to get satisfactory let-style bindings without re-implementing let
and therefore abandoned the approach. But it would be interesting to see! We experimented with prismatics fnk
for that approach.
A #malli + #babashka co-announcement by @ikitommiand me 🎉
metosin/malli {:mvn/version "0.8.9"}
- and #babashka 0.8.157 are now compatible.
Both projects have had a new version released today to celebrate.
This is how you can use malli in a babashka script:
(ns bb-malli
(:require [babashka.deps :as deps]))
(deps/add-deps '{:deps {metosin/malli {:mvn/version "0.8.9"}}})
(require '[malli.core :as malli])
(prn (malli/validate [:map [:a [:int]]] {:a 1}))
More info here:
https://github.com/metosin/malli#babashka

That's excellent news, congrats!
Thanks @U04V15CAJ! Looking forward to seeing dev-tools/scripts built on top of this: schema inferrers, coercers, pretty printers etc.
Very excited about this! Thank you for the work and effort bringing these together!
brilliant!
Up until now, there is not any mutable heap (priority queue) data structure implemented using pure Clojure. We’re therefore excited to announce the release of https://github.com/clojure-finance/clojure-heap. We implemented every necessary API of a priority queue, including add
, poll
, peek
, etc. Transient variables are used to boost the speed of clojure-heap. Unlike https://github.com/clojure/data.priority-map/ or java/priority-queue, you can store basically any Clojure type to clojure-heap without sacrificing much performance.
Not released on clojars, but copy-paste a file into one's project?
Otherwise, looks cool!
it doesn't really, it is using the transient as a mutable collection, bashing on it in place, which the docs specifically say not to do, and will not work on larger collections (transient operations may existing or return new values)
yeah, that's broken
@hiredman Thank you for pointing this out. Actually in the pre-release, we did utilize the return value of the transient. However then in the optimization, we found that the return value and the input are the same, so we ignored all the return values. Sorry that we did not find this action is against the transient norms. We have reverted the version back to the “return value” one.
@U03JDCVV1MX I can set aside some time if you need help publishing to clojars or maven central. You would probably want to select unique coordinates other than clojure.heap
and java.core
for the namespaces. Also porting to deps.edn would allow you to have it available as a git dep
@U3JH98J4R @UEENNMX0T Thank you for the kind suggestions. The project is on Clojars.
> Also porting to deps.edn would allow you to have it available as a git dep FYI, libs like this can be used as a gitlib by overriding tools.deps manifest detection, like so:
com.github.gnarroway/hato {:git/tag "v0.8.2" :git/sha "e75c194" :deps/manifest :deps}
…explicitly specifying :deps/manifest
as :deps
triggers tools.deps to consider the lib a tools.deps lib. And it doesn’t mind that deps.edn
doesn’t actually exist.
Of course, if the lib has any dependencies, they’ll need to be also added to the project’s deps.edn
and they won’t update automatically if you change versions (tags) so this works best for libs that have no deps or only a few deps.Just released antq ver 1.8.847 Tool to point out your outdated dependencies. https://github.com/liquidz/antq Added progress bar to table reporter, and applied timeouts to some external operations.
@hiredman Thank you for pointing this out. Actually in the pre-release, we did utilize the return value of the transient. However then in the optimization, we found that the return value and the input are the same, so we ignored all the return values. Sorry that we did not find this action is against the transient norms. We have reverted the version back to the “return value” one.