Fork me on GitHub
#announcements
<
2022-07-01
>
tgk09:07:36

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.

🎉 8
Geoffrey Gaillard09:07:32

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"

tgk10:07:24

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 [] ...)

tgk10:07:34

So the strategy is very naive to avoid any surprises.

👍 1
chopmo10:07:34

Another thing worth mentioning is that all bindings need to be declared at the top level. This to make the ordering explicit.

Geoffrey Gaillard10:07:59

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)

tgk10:07:55

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.

👍 1
borkdude11:07:00

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

🚀 34
babashka 20
malli 17
😍 8
👍 5
💯 5
🎉 4
❤️ 2
Adam Helins11:07:17

That's excellent news, congrats!

ikitommi11:07:36

Thanks @U04V15CAJ! Looking forward to seeing dev-tools/scripts built on top of this: schema inferrers, coercers, pretty printers etc.

👍 1
russmatney12:07:37

Very excited about this! gratitude Thank you for the work and effort bringing these together!

Clojask17:07:06

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.

🎉 8
👍 3
Noah Bogart17:07:15

Not released on clojars, but copy-paste a file into one's project?

Noah Bogart17:07:23

Otherwise, looks cool!

hiredman18:07:28

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)

👍 2
Clojask03:07:31

@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.

emccue15:07:16

@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

Clojask03:07:17

@U3JH98J4R @UEENNMX0T Thank you for the kind suggestions. The project is on Clojars.

avi14:07:04

> 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.

👍 1
Matt14:07:10

Many thanks for the suggestions, much appreciated. We're looking into it.

👍 1
uochan21:07:05

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.

🎉 18
Clojask03:07:31

@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.