off-topic

https://github.com/clojurians/community-development/blob/master/Code-of-Conduct.md Clojurians Slack Community Code of Conduct. Searchable message archives are at https://clojurians-log.clojureverse.org/
yuhan 2021-03-13T11:14:13.320200Z

So I recently learned about de Bruijn indices ( https://en.wikipedia.org/wiki/De_Bruijn_index ) and it occured to me that it could be used as a "solution" for Clojure's lack of nested #() functions, allowing things like:

(map #(every? #(< % 5) %)
  [[1 2] [3 4] [5 6]])
If the inner function needed to access the outer parameters, we just increment the number of %s according to the number of levels "outwards" we want to jump, so there's never any ambiguity:
(map #(every? #(< % (count %%)) %)
  ...)

borkdude 2021-03-13T11:17:05.321100Z

I think there's another reason to not nest #() (babashka currently allows it, that's an oversight and will change): it's more unreadable. I would say, just use fn and meaningful arg names.

1๐Ÿ‘†
yuhan 2021-03-13T11:21:37.324600Z

Yeah I'm not disputing that - no doubt it was a conscious language design choice to avoid readability disasters, I've just always been slightly annoyed with how #() doesn't compose and thought this was an interesting way around it

yuhan 2021-03-13T11:24:49.326700Z

(This comes up sometimes when writing throwaway code to inspect data, I'll write a quick #() argument to max-key just to find that oh, it's not compilable because of an enclosing form)

p-himik 2021-03-13T13:21:12.330600Z

I'm trying to write a good and proper bash script for some particular dev task. But the more proper it becomes, the harder it gets to write it. "I need an array of arbitrary values that might have spaces and newlines". A voice in my head: "babashka would help here". Me: "Yeah, but it's just one place." "I need to diff two arrays". The voice: "babashka". Me: "Maybe later". "I need a function that accepts N arrays and returns another array, and that correctly handles edge cases with empty arrays". Yep, it's babashka time.

52
2021-03-13T13:34:35.331100Z

I would have reached for Python or Clojure at the first step there ๐Ÿ™‚

raspasov 2021-03-13T14:14:46.332600Z

Bash is one of those things that I always actively refused to learn beyond a stackoverflow copy/paste. Seems like the most arbitrary syntax ever ๐Ÿ™‚

1โž•
borkdude 2021-03-13T14:16:52.332800Z

https://twitter.com/borkdude/status/1098561060548870144

1๐Ÿ˜ฎ
raspasov 2021-03-13T14:18:12.333400Z

@borkdude is that before you did babashka? ๐Ÿ™‚

borkdude 2021-03-13T14:21:06.335200Z

I think it's the same kind of satisfaction you get from solving type system puzzles, not problems, which Rich mentioned in one of his talks. You're fighting with an arcane tool but when you get it finally working, you have this sense of satisfaction. But you could have just avoided spending all that time by just using Clojure. :)

raspasov 2021-03-13T14:21:57.335700Z

100% agree.

lilactown 2021-03-13T16:03:22.336700Z

honestly bash is pretty cool, just too niche for me to learn and keep warmed in my brain-cache

lilactown 2021-03-13T16:04:41.338Z

I remember playing around with developing some make-like task runner that sent commands to a JVM daemon. the advanced features you get from bash + basic GNU toolbox is pretty amazing

lilactown 2021-03-13T16:37:29.340Z

:bikeshed: if I was building a framework whose core public API was very clojure-y, but I also wanted to deliver a monadic API with things map, bind, return, etc. what could I call that namespace?

borkdude 2021-03-13T16:38:00.340400Z

foo.monad ?

lilactown 2021-03-13T16:39:52.341400Z

I was thinking about foo.monad but then I started wondering if there was a clearer way to name it - maybe a lot of people who do Clojure know monads, but not everyone

marrs 2021-03-13T16:41:56.341900Z

Hereโ€™s their opportunity to learn :)

marrs 2021-03-13T16:43:44.343600Z

In my experience itโ€™s better to give something a precise definition that can be learnt once and understood forever more than a friendly one that is ambiguous and confusing or misleading

lassemaatta 2021-03-13T16:45:01.344800Z

exactly, therefore I suggest foo.monad-is-just-a-monoid-in-the-category-of-endofunctors. And maybe slap a .core in the end just to make it familiar ๐Ÿ˜‰

lilactown 2021-03-13T16:45:31.345Z

lol

lilactown 2021-03-13T16:45:59.345200Z

I see your point marrs

marrs 2021-03-13T16:49:14.348200Z

I say this as someone who still couldnโ€™t tell you what a monad is, despite having learnt Scala cats well enough to have used it successfully in a real project. Not sure what the lesson of this experience is

lilactown 2021-03-13T16:49:57.348600Z

I expect the reason that people would reach for the monadic API would be either for performance or because they just sort of enjoy the aesthetics of algebraic composition ๐Ÿ™‚ so advanced usage

marrs 2021-03-13T16:57:43.350600Z

On the subject of scripting shells, Iโ€™m a recent convert to Fish

flowthing 2021-03-13T17:15:05.354100Z

There was a blog post making the rounds a while back where a Common Lisp (I think) programmer compared CL and Clojure REPLs and explained some of the features Clojure editors/REPLs don't have that CL does. Anyone happen to remember that post and have a link handy? My Google-fu isn't strong enough to find it, it seems. In general, if you have any wisdom to expend regarding some of the more advanced REPL features that CL/Scheme/Racket have but Clojure doesn't, I'm interested.

lilactown 2021-03-13T17:20:31.354900Z

I think conditions are the biggest feature missing from Clojure compared to CL or Scheme

lilactown 2021-03-13T17:23:26.356300Z

just from a dev UX standpoint, the ability to interactively halt your program on an error, modify, then resume it where it left off is pretty awesome

flowthing 2021-03-13T17:40:53.358Z

Thanks! That rings a bell, and I think itโ€™s something that was also mentioned in the blog post.

2021-03-13T17:43:20.358600Z

There was a brief interaction in #beginners channel yesterday on this, starting here: https://clojurians.slack.com/archives/C053AK3F9/p1615601443403100

flowthing 2021-03-13T17:44:05.359400Z

Thanks! Iโ€™ll check that out.

2021-03-13T17:44:46.360600Z

Which included someone sending a link to this project on Github, which lists several similar things that people have created to do interactive kinds of debugging/dev at a Clojure REPL (I haven't used any of them, but its README of other projects looks like a pretty nice list to go through, if you want to see whether they do what you want): https://github.com/clojureman/special

alexmiller 2021-03-13T17:45:16.361100Z

re condition systems, there was a great talk at the conj a couple of years ago about this in Clojure context https://www.youtube.com/watch?v=zp0OEDcAro0

2๐Ÿ‘€
flowthing 2021-03-13T17:47:50.361700Z

Thank you! Will watch that. ๐Ÿ‘:skin-tone-2: