Fork me on GitHub
Eccentric J01:04:25

If my memory serves, there were some docker images for using open-jdk + node I think, which I am looking to use for a shadow-cljs project. Anyone recall a solid docker image like that?

Jakob Durstberger08:04:15

Hello, I have been learning Clojure for a while now and feel quite comfortable building smaller things. Something I struggle with is how to organise and architect in a functional language. I come from OO so that way of thinking is really engrained in me, are there any good books or talks on how to architect Clojure programs?


Structure and Interpretation of Computer Programs could help in general

👍 6

Probably Clojure Applied is something that you might want to take a look at - (link from

👍 9

Namespace-wise it's not really that different from a procedural language (e.g. plain C). For stateful components dependency injection is still good e.g. And you won't run into Haskell-style "stacking monads" organization challenges.

👍 3

In specific cases like Ring/Reitit/Re-frame middleware/interceptors are quite prominent for cross-cutting concerns


...if you are doing web stuff

Jakob Durstberger08:04:52

Thanks that’s already great stuff. I don’t mind opinionated as a starting base 🙂


Clojure Applied is a good book too

Jakob Durstberger11:04:42

Just realised that I bought that one, but never read it 😄


I'm a big fan of the book Elements of Clojure and it's precisely about how to architect clojure programs (you'd need another book like Clojure Applied for learning the language itself)

💯 3

is there a way to control the text color with timbre console logging?

delaguardo08:04:24 you can use that library in combination with timbre’s option :fmt-output-fn to format desired string

Jakub Holý09:04:51

A thought I want to share. I am reading the awesome book and came upon these there: > [..] families of parts that are built around a standardized interface specification can be mixed and matched to make a great variety of systems. > [..] be liberal in what you accept from others [i.e. accept a wider range of inputs than strictly necessary] and it hit me that JavaScript (when applying;a_bid=d5b546b7) and Clojure can be seen as languages designed for flexibility according to these: • representing information using the general data structures (maps, arrays) creates such a standardized interface - you can plug in any data-processing library into your pipeline (for instance I've used a data diffing lib to verify that refactoring produces the same results as the old code) - that is impossible with OOP and its unique-for-use-case types (without reflection black magic) • best practice in Clojure, equally possible in JS, is that you only check inputs for the presence of what you require but allow any additional data in there, i.e. being liberal about inputs; thus somebody upstream can start sending additional data to somebody downstream w/o affecting all functions in between

Jakob Durstberger09:04:01

Ah thank you for those links. These might be actually very close to what I have been looking for recently 😄

❤️ 3

In Haskell you get a similar data interface with lenses etc. and any number of lenses can be added for any type at any time! But the learning curve is vim-tastic 😅


what are people using for websockets with ring/jetty these days?


I love Sente


We have about 50 lines of code in a ns that implements on-connect , on-close, on-error, on-pong with a little additional ceremony.


How much time do you find you spend making clojure code “look good”, visually speaking? I really enjoy designing the code, artistically. Forming it into tables, aligning things, checking rhythms and flows… :male-artist:


I just Ctrl+Alt+L in Cursive so the answer is... no?

👍 6

sometimes you have to manually do it, aligning vectors, match clauses, etc. Teams can be quite strongly attached to alignment as well. Some like maps to be aligned, some think this is useless diff and invites needless conflicts on rebase/merge etc


Haha, yea I use the auto align/format tools a ton for macro layout, but sometimes I’ll go in and tweak subtle things to polish it.


At the detriment of my productivity at times 🙂


> some think this is useless diff -b`-w`, so I don't share the sentiment! From the git manual: > -b > --ignore-space-change > Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent. > > -w > --ignore-all-space > Ignore whitespace when comparing lines. This ignores differences even if one line has whitespace where the other line has none. magit has opt-in flags for both, see screenshot, not sure about other editors

🤯 3

I use align-regex in emacs reasonably often to tidy up the vertical alignment of thing that cider doesn't do with C-c SPACE ... it doesn't suck up much time... and I've had bad experiences with all the code formatting tools that I've used ... but I like whitespace changes to generally be their own commit, so they can be dealt with independently and say that they're introducing no functional changes


I’ve been liking calva’s alignCurrentForm for vertical alignment. There’s something deeply satisfying about table-like data. I think it’s well worth its costs.


We have non-devs who access the codebase, so it all gets the zprint pre-commit hammer

Lyderic Dutillieux17:04:44

I stumbled upon "Code aware merges" or "Semantic Merges" like this one for C# : I'm wondering if such a technology exists for Clojure ? What could possibly prevent us from making a "sexp/clojure aware merge algorithm" ? That would be very convenient.

👍 3

Nothing except lack of trying 🙂 There are lots of data diffing and patching libs for Clojure already, maybe there would be some challenges combining that with rewrite-clj but maybe not


I think Cursive does a little bit of this already but that is not ideal for everybody

👀 3
Lyderic Dutillieux17:04:53

Just to illustrate some use case : Let's say I have a function

1. (defn compute [arg1 arg2] ...)
and a first contributor adds a commit that call the function
1. (defn compute [arg1 arg2] ...)
5. (compute 1 2)
and a second contributor renames and calls the function
1. (defn multiply-by [arg1 arg2] ...)
18. (multiply-by 3 4)
Then in this case, the classical git merge will merge successfully and keep the 5th line with compute whereas a code aware merge/helper would at worst issue a conflict without any suggestion, and at best suggesting to replace compute by multiply-by.

Lyderic Dutillieux17:04:36

That's definitely worth digging, thanks for the pointers


No merge, just diff, but maybe relevant:

🙌 3

the question doesn't really fit anywhere, but it probably fits best here anyway does java have any libraries for creating TUIs? Something like rs-tui from rust or termui from golang?

Eccentric J19:04:06

I know this isn’t 100% what you asked for but might be another option 😅


I know, I've used it, I think we've even talked about it before

Eccentric J20:04:32

Hah my apologies, couldn’t resist when I saw the subject come up 😛

Eccentric J20:04:59

Did it work ok for your needs or did you run into issues?


It's great, but today we have graalvm and I would rather stay with native binaries and get away from nodejs


Another even simpler solution is to use

Eccentric J20:04:21

That’s adjacent to what the template uses, though that reminds me to try it out and see if it would be better than blessed + react bindings.


A lot depends on how complex a UI you intend to make. INK is not particularly suitable for displaying large amounts of content as on some dashboards.

Eccentric J20:04:09

Interesting. Do you happen to know why?


but for me it worked great where the user simply had to select one of many things to choose from to trigger some application action.


If nothing has changed, INK does not have the ability to place other components in squares


there were only buttons that could have text inside and trying to put something more complex in there ruined everything

Eccentric J20:04:41

It seems like that changed as the examples indicate a Box with Boxes in them


I'm not a native speaker, by saying box I don't mean a <box> component but creating borders and dividing the view into smaller elements with clear edges


However, I see now that it seems to have changed a bit over the last year when I last checked. I'll check right now to see if it's possible to make a nested box

Eccentric J20:04:50

Also of note, you can use graalvm to build from js as well as java.


thanks! Looks like it's working, I already know what I'm doing tomorrow : >


I haven't tried to use graalvm to compile js yet, but there is another fundamental problem. imho clojure > clojurescript.

Eccentric J20:04:43

Depends on the trade-offs for a given problem space in my experience. May try switching the cljs-tui template to ink this week though as it seems better maintained


When you finish, share your results, I'd love to see

Jakub Holý07:04:12

I think this question is a good fit for #find-my-lib even though you ask for Java


lanterna also has some clojure wrappers. but it's still based on version 2 afaik. I made a start with upgrading to version 3 here:

👍 3
❤️ 3

I was just about to write that there is a lantern, but curses are not exactly what anyone would want to use today 😉 it is traditionally ugly


another Java API


there is the same problem with jexer, it mimics courses and tries to replace the traditional GUI with overlapping windows and other horrible things.


there is also which is not actively worked on


and there was also this project which abstracted UI for browsers, tui, etc. forgot the name, it looked really ambitious


I know what project you're talking about, I'll find the link


I checked all my starred repos on github because I was sure I gave it one, but no.


I just updated the example project that uses lanterna,

❤️ 3

thanks!, looks awesome


Somehow I forgot that it can render ui in terminal


The lanterna backend has less use than some of the others so don't hesitate to ping me if you run into any issues or have questions


yes, that one!


@smith.adriane is that still based on lanterna 2?


I'm not sure it was ever based on lanterna 2. The dependency was 3.0.2 and I just updated it to 3.1.1


oh you are using lanterna directly, not clojure-lanterna. nice

👍 3

I don't use any of the built in widgets, I just use lanterna for the raw graphics and events

hipster coder23:04:26

is there a way to turn a clojure exe (jar) into a command line script... so I don't have to call it with java jar ?

hipster coder23:04:47

that way I can use Clojure to write all of my command line scripting, dev ops, on linux

hipster coder23:04:23

very specific example is.... git custom commands... it doesn't care what the script is written in... just needs to be executable ./script-name

hipster coder23:04:05

@brennan.holten thank you. this helps a lot.

hipster coder23:04:05

just tried it, it works, awesome @brennan.holten

🙌 9