Fork me on GitHub
#announcements
<
2022-03-18
>
borkdude18:03:21

This release, among other things, adds compatibility with babashka:

(require '[babashka.deps :as deps])

(deps/add-deps '{:deps {com.rpl/specter {:mvn/version "1.1.4"}}})

(require '[com.rpl.specter :as s])

(s/transform [(s/walker number?) odd?] inc {:a 1 :b [1 2 3]}) ;;=> {:a 2, :b [2 2 4]}

slimslenderslacks18:03:30

This is very exciting - two awesome tools, and now together!

wilkerlucio21:03:34

any plans to make something like this for #meander? would really love that 🙂

borkdude21:03:46

@U066U8JQJ with specter I was able to make it run without big changes. with meander, I think I will run into the same issues as with pathom: custom data structures that implement a ton of Java interfaces

wilkerlucio21:03:24

gotcha, I remember the new version they are making has less of that, maybe this will be the one to work with Babashka

wilkerlucio21:03:37

but Pathom, besides the smart maps, everything else already works on Babashka 🙂

borkdude21:03:15

always worth a shot :)

borkdude21:03:07

Apart from a reflection issue (.indexOf ...) the meander.match.epsilon namespace seems to load.

$ clojure -M:babashka/dev -cp src -e "(require '[meander.match.epsilon])"

borkdude21:03:00

(require '[meander.match.syntax.epsilon])
also works

borkdude21:03:38

(require '[meander.rewrite.epsilon])
also works

borkdude21:03:19

@U066U8JQJ It seems all necessary namespaces for meander.epsilon load, I just get one error in the ns itself, will look into it.

borkdude21:03:31

We can take the discussion elsewhere maybe.

borkdude21:03:05

@U066U8JQJ Wow, it works, if I comment out defsyntax with !

$ clojure -M:babashka/dev -cp src -e "(require '[meander.epsilon :as m])
dquote>
dquote>
dquote> (defn favorite-food-info [foods-by-name user]
  (m/match {:user user
            :foods-by-name foods-by-name}
    {:user
     {:name ?name
      :favorite-food {:name ?food}}
     :foods-by-name {?food {:popularity ?popularity
                            :calories ?calories}}}
    {:name ?name
     :favorite {:food ?food
                :popularity ?popularity
                :calories ?calories}}))
dquote>
dquote> (def foods-by-name
  {:nachos {:popularity :high
            :calories :lots}
   :smoothie {:popularity :high
              :calories :less}})

(favorite-food-info foods-by-name
  {:name :alice
   :favorite-food {:name :nachos}})"

{:name :alice, :favorite {:food :nachos, :popularity :high, :calories :lots}}

wilkerlucio21:03:28

:star-struck:

wilkerlucio21:03:43

wow, that's awesome, Meander is one of libs that I miss the most when using Babashka

wilkerlucio21:03:44

long way, seems like all the fixes for other things are almost making Meander works 🙂 @U5K8NTHEZ @U06MDAPTP

borkdude22:03:02

Going to dig into why this error with defsyntax with happens (unresolved symbol, some gensym) but it seems promising. :-D

borkdude22:03:44

Found the issue

borkdude23:03:17

I'm hitting a couple of reflection issues. E.g. .without on clojure.lang.IPersistentMap etc, gotta add those in bb explicitly

borkdude23:03:11

not sure why that low level interop is necessary, small perf gain?

borkdude23:03:24

(in bb it will be much slower)

borkdude23:03:21

but I'll try to support it so meander doesn't have to change anything

borkdude23:03:35

@U066U8JQJ I pushed a commit which makes the above example work. Binary will be in #babashka-circleci-builds in 10 minutes or so. Probably needs more testing, will do so tomorrow. This is really cool!

borkdude23:03:50

bash <(curl ) --version 0.7.9-SNAPSHOT --dir .

(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {meander/epsilon {:mvn/version "0.0.650"}}})
(require '[meander.epsilon :as m])
(m/find [1 2] [?x ?y] ?y [?x ?y ?z] ?y) ;;=> 2
The good news is that it works. The bad news is that the loading of the lib takes quite long due to the amount of code.

wilkerlucio23:03:05

you rock man! I'm in the middle of a thing from work today, but I'll be happy to test it next week 🙂

borkdude14:03:25

@U066U8JQJ I invited you to #babashka-sci-dev - let's continue there. There are a couple of things like r/gather which result in unexhaustive matches.

jacob.maine23:03:41

https://github.com/mainej/re-stated 0.2.25 Small but flexible tool for managing clj-statecharts state machines within a re-frame app. Comes with many examples where state machines can simplify a domain: • tracking status of HTTP requests • navigating wizards • recording input field interaction history

🎉 7
p-himik23:03:51

Alright, this is now a fourth library that I know of that adds statechart to re-frame. Seems like I should finally give statecharts a go. :D If anyone's interested, the other libraries (apart from clj-statecharts built-in re-frame integration) are: • https://github.com/jiangts/re-statehttps://github.com/MaximGB/re-statehttps://github.com/ingesolvoll/re-statecharts

jacob.maine00:03:57

@U2FRKM4TW that’s right, there are a ton of options! You haven’t even touched on https://github.com/fulcrologic/statecharts, or any of the many other state machine libraries and their re-frame integrations. I’m partial to re-stated because: • it’s small—70 loc, no macros • it comes with lots of docs and examples • and it doesn’t try to be The Way to Structure Your App; it’s just a thin adapter between re-frame and clj-statecharts

👍 1