This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-18
Channels
- # aleph (1)
- # announcements (31)
- # babashka (9)
- # babashka-sci-dev (36)
- # beginners (72)
- # calva (20)
- # clj-kondo (99)
- # cljsrn (1)
- # clojure (77)
- # clojure-europe (33)
- # clojure-nl (4)
- # clojure-norway (12)
- # clojure-uk (4)
- # clojurescript (23)
- # cursive (2)
- # datascript (5)
- # events (1)
- # fulcro (3)
- # honeysql (3)
- # inf-clojure (82)
- # interop (2)
- # kaocha (10)
- # lsp (15)
- # meander (1)
- # missionary (10)
- # off-topic (22)
- # pathom (4)
- # pedestal (3)
- # polylith (20)
- # re-frame (10)
- # react (4)
- # reagent (4)
- # reitit (27)
- # ring-swagger (1)
- # shadow-cljs (34)
- # specter (3)
- # sql (1)
- # testing (5)
- # tools-deps (22)
- # vim (12)
Specter 1.1.4 https://github.com/redplanetlabs/specter/blob/master/CHANGES.md#114 Thanks @nathanmarz
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]}
This is very exciting - two awesome tools, and now together!
any plans to make something like this for #meander? would really love that 🙂
@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
gotcha, I remember the new version they are making has less of that, maybe this will be the one to work with Babashka
but Pathom, besides the smart maps, everything else already works on Babashka 🙂
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])"
@U066U8JQJ It seems all necessary namespaces for meander.epsilon
load, I just get one error in the ns itself, will look into it.
@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}}
:star-struck:
wow, that's awesome, Meander is one of libs that I miss the most when using Babashka
long way, seems like all the fixes for other things are almost making Meander works 🙂 @U5K8NTHEZ @U06MDAPTP
All credit to @U06MDAPTP
Going to dig into why this error with defsyntax with
happens (unresolved symbol, some gensym) but it seems promising. :-D
I'm hitting a couple of reflection issues. E.g. .without
on clojure.lang.IPersistentMap
etc, gotta add those in bb explicitly
@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!
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.you rock man! I'm in the middle of a thing from work today, but I'll be happy to test it next week 🙂
@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.
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
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-state • https://github.com/MaximGB/re-state • https://github.com/ingesolvoll/re-statecharts
@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