Fork me on GitHub
#clojure-europe
<
2021-10-14
>
RAMart06:10:56

Hi all! My latest moment of greatness: I had to work with a rather unhandy data structure. Lots of if and cond and the like in my code. I was very unhappy. Then a flash of genius strikes me: The data structure is spec'ed. All the unhandiness is defined there. What if I https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html#clojure.spec.alpha/conform the data structure, manipulate the instance of the spec (as fulfilled by the data structure) and use https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html#clojure.spec.alpha/unform to get the resulting data structure back? Turns out that this was much easier to handle in my case. It also turns out that this is nothing new, everyone is doing so and I'm super late to the party. 😂 But I thought it might be worth sharing nonetheless: 💡 If you need to evaluate or manipulate an unhandy data structure, have a look at its spec. It may be easier to work with the data structure's https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html#clojure.spec.alpha/conform counterpart.

💡 3
simongray06:10:25

@ramart Interesting approach.

dharrigan06:10:04

Good Morning!

javahippie06:10:52

Also had an “everybody is doing it” epiphany this morning and learned that you can and should cache the .shadow-cljs folder in the ci pipeline

1
borkdude07:10:55

@javahippie can you tell more?

pez07:10:12

Good, somewhat grumpy, morning. I have been fighting with my Windows machine. Access denied on java. Struggling with path variables and various scoop issues to get a new java in place. Then I run into parsing of command line issues. Almost two hours with this and I didn’t even solve it. Didn’t need to right now, because the Calva issue I was checking doesn’t care about Java now that I can use nbb instead. Thanks for adding nrepl to that tool, @borkdude!

pez07:10:33

I saw a thread on Reddit where someone asked about what OS to use with Clojure development, Windows or Linux. I resisted the urge to warn about Windows, because I am unsure if it is just me. But as far as Calva dev goes, Windows is the new IE6. I spend 80% of the time on Windows issues. (Well, maybe not, but everytime I spend time on them, hours upon hours just burn up.)

borkdude08:10:52

Indeed. It's annoying. But a reality. Perhaps look at the previous Clojure survey how many Windows users there are. Or make your own survey. If there's almost none, perhaps give it lower priority. But in every niche Windows user that opens Calva for the first time there is a potential new fellow Clojurian!

Jakub Holý (HolyJak)09:10:49

We just need to find a Windows user that is fond of Calva and willing and able to maintain it there 🙂

1
borkdude09:10:35

I have someone like this in the #babashka "community", he is very helpful

borkdude09:10:08

It also helps to have Windows CI set up, but with a visual tool like Calva I can see this is much harder to do without wasting a lot of time.

pez09:10:09

So far I think I have counted that we would need 7 or 8 Windows CI setups…

pez09:10:10

Windows users are in minority for sure. But I just would never be able to bring myself to let them have bad experiences without giving it a shot trying to fix and/or help them with workarounds. This is a burden I must shoulder. I should probably practice in doing it with a smile instead of always being on the brink of throwing the Windows machine out the window (pun not intended, but haha). 😃

❤️ 3
borkdude09:10:32

I feel the same way

borkdude07:10:14

I don't exactly how you "replaced" Java with nbb, but you're welcome 😆

pez07:10:58

This issue https://github.com/BetterThanTomorrow/calva/issues/1332 Which I first thought was because I had fixed your issue with the cursor flying away with inline results. It wasn’t, thankfully, but a super duper strange ECMA thing that I have not the faintest clue on. He is using Windows and I wanted to rule out that as a single cause of the issue. Anyway, all I needed to do was check that inline results display, I wether the evaluation had traveled to a JVM and back with the results wasn’t important. 😃

Fahd El Mazouni08:10:11

today reading library docs to choose those who will replace spring ! 🎉 (open to recommendations if you have any, especially when it comes to websockets)

Jakub Holý (HolyJak)08:10:55

You mean Spring Framework? That's like a thousand heads hydra. Which heads in particular are you replacing?

Fahd El Mazouni09:10:27

see that's kind of part of why I'm so happy to get rid of it. It handles a lot of stuff, in a way that seems magical. It handles authentification, password hashing, websockets, and the whole webserver deal with routes and handlers and all that jazz. I've tried to clear things up by reading docs many times, but I didn't always find it helpful

Jakub Holý (HolyJak)09:10:21

💯 That is why I wrote https://blog.jakubholy.net/2020/spring-nevermore/ (notice I kept myself from expressing my true feelings in the title, though they show up in the url :)) We use http-kit, which has built in support for websockets. It does not seem to be maintained much but it is stable and performant. Not sure whether you are looking for clojure or java solutions?

👍 1
thomas09:10:43

hmmm Spring... that brings back memories night mares...

😂 2
Fahd El Mazouni10:10:19

oh thanks ! will definitely read this ! right now reading ring documentation then maybe I'll have a look at pedestal, but good to know that http-kit has built-in websocket support !

Jakub Holý (HolyJak)11:10:01

Ring is used much more so it might be easier to find libraries and get help, though #pedestal is certainly a quality choice too

Jakub Holý (HolyJak)11:10:45

BTW I guess you know about #luminus? (though personally I prefer to start with plain Ring and only add stuff when unavoidable)

Fahd El Mazouni11:10:40

heard of luminus but I also believe in minimalism 😛 actually mostly support and how easy it is to get help

borkdude09:10:41

Mornings facepalm 😄

lread16:10:51

Good morning!