This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-25
Channels
- # ai (8)
- # announcements (18)
- # architecture (6)
- # babashka (28)
- # bangalore-clj (1)
- # beginners (14)
- # calva (2)
- # cider (10)
- # clj-kondo (64)
- # clojure (87)
- # clojure-conj (3)
- # clojure-europe (28)
- # clojure-nl (2)
- # clojure-norway (11)
- # clojure-spec (24)
- # clojure-sweden (3)
- # clojurescript (4)
- # clr (8)
- # cursive (21)
- # data-science (5)
- # datomic (2)
- # defnpodcast (2)
- # figwheel-main (6)
- # graalvm (2)
- # hyperfiddle (15)
- # juxt (3)
- # lsp (5)
- # off-topic (32)
- # polylith (1)
- # practicalli (1)
- # rdf (7)
- # shadow-cljs (39)
- # sql (8)
- # xtdb (8)
Observation (not sure if this is a bug or intended behavior) In Clojure vectors have a contains method
user=> (.indexOf [100 101 102] 101)
1
user=> (.contains [100 101 102] 101)
true
In bb
user=> (.indexOf [100 101 102] 101)
1
user=> (.contains [100 101 102] 101)
java.lang.IllegalArgumentException: No matching method contains found taking 1 args for class clojure.lang.PersistentVector [at <repl>:3:1]
@U06F82LES We can add this, issue welcome
but usually I recommend using "pure" clojure and no interop on what might be implementation details
*nods*
I went with some
now
So this works:
$ echo '{"@foo":"bar"}' | jet --from json --keywordize
{:@foo "bar"}
but this crashes:
$ echo '{"@foo":"bar"}' | jet --from json --keywordize | jet
Exception in thread "main" clojure.lang.EdnReader$ReaderException: java.lang.RuntimeException: Invalid constituent character: @
...
yes, in general it's possible to produce EDN in Clojure that you cannot read back, this is not specific to jet
@
is not allowed in symbols and keywords as it expands to (deref ...)
in normal Clojure
I am certainly playing both sides here (I like janet) but have you guys seen this post about using janet for shell scripting? https://janet.guide/scripting/ Maybe borkdude can get some ideas from it
I have a friend who's real into Janet. I got him into lisp so I'll take some credit. He loves to build games with it. Do you use it for game programming?
@U06BQ07JS do you know what he is using besides janet? raylib? I know tic80 has support for janet now, too.
https://alectroemel.com/ looks like tic80. I don't know what that is though
He mentions fennel, but maybe he's switched from that
Ah yeah, looks like he didnât blog about his janet project yet. his pancake simulator is hilarious: https://alect.itch.io/pancake-simulator
I actually use it for much right now, but I did advent of code using it in 2021
babashka process has a similar $
macro but it faded away into the background as I found it too magical, just use process/shell
, process/process
and ->
I don't think it's great to shell out to thing like sed
etc as babashka tries to encourage cross-platform scripting (scripts I write should work on mac, linux and windows)
^^ avoiding the problem with âoh, your version is slightly different from the GNU version or default BSD versionâ
which devolves, distressingly often, into âjust rub some autoconf on itâ, and then itâs a whole Thing, and no longer a nice lil script.
yeah, that sed example is contrived though, he mentions PEGs right after
i agree that in both cases you want to do more of the logic, especially parsing, in lisp land
seems like it strikes an interesting middle-way, like it sits in-between shell-scripts and langs like python. personally I try to shell out as little as possible, so it kinda defeats the purpose for me.. But if I were to build my workflows around lots of different, unrelated cli tools then it looks like it'd be a good glue
I mostly use babashka for this niche, actually. Wrangling stuff into e.g. some curl invocation