Fork me on GitHub
Jakub Šťastný02:07:00

I need to iterate over all items of a list and return true if all runs of a lambda returned true (and preferably not to iterate once/if it gets first no). For instance say I have `["test", "tests", "abctest", "third item"], I want only to return true if all matched #"test". (If it helps, in Ruby it's: ["tests", ...].all? { |item| item.match(/test/)


As a beginner I would like to vent that there is such a massive difference in all the tools associated with clojure are so different and each of them have their own specific pitfalls.... there is not a lot of text to warn beginners against these.... I started with lein. Very soon realized that adding a library in lein is not as straight forward. I kept on getting errors when I added newer libraries. Then I moved on to boot and I quickly abandoned it because it felt like it was a brand new language!! Finally I've settled on clj because I found the learn-clojurescript ebook which guides you through the process. On another note, setting up emacs is also a massive problem. I've now managed to setup VSCode with Calva and it works ok for me... but there are still issues like how does this get integrated with shadow-cljs or figwheel... maybe there should be a page which gets beginners through these pitfalls so that they can focus on just learning the language instead of having to jump hoops around tooling.... Ok rant over! 😄


I understand the pain, every ecosystem is this way however. It's a natural consequence of the trade.


I disagree there! It is not this painful... I work quite a lot with python/C/C++/m-script in my day job. Non of it is this complicated to just setup!!

Bill O'Brien13:07:56

Anything in particular with emacs that I could help with?


I would love for you to expand upon "errors when adding newer libraries"

Tomas Brejla13:07:56

> adding a library in lein is not as straight forward. I kept on getting errors when I added newer libraries. Can you be more specific? Which libraries did you have issues with? While many use clj (deps.edn) these days, lein is still widely used and I don't remember havin any issue with adding newer libraries. > Then I moved on to boot and I quickly abandoned it because it felt like it was a brand new language!! Interesting. I'd not expect that boot would be a second option. If you look at, boot is far less popular. It's questionable whether it's a good thing or not to study state of X -type of articles when learning X, but I'd personally use such articles to at least get some basic overview about what tools/libs/approaches are there, what's their adoption etc. > On another note, setting up emacs is also a massive problem. I'd probably skip that effort completely when learning clojure/cljs, unless I was already an emacs user before. There's so many things to be learned in the language + platform already, so it's a good idea to focus on these first. VS Code + Calva or IntelliJ IDEA + Cursive might be great choices if one doesn't want to spend ages learning the editor/ide itself. > there are still issues like how does this get integrated with shadow-cljs or figwheel Again, I'd probably spend some time getting used to basics, such as clojure language itself and its tooling, getting used to interactive REPL-driven development, learning some helpful libraries etc. I'd give it a time, relax, not try to learn too many things at once. But of course, if your main interest is to learn web frontend development, it makes sense that you want to try shadow/figwheel asap. I'd probably invest into some tutorials or at least watch some free hands-on on youtube. They might accelerate the learning (starting a project) a lot. In the end, setting up shadow-cljs project that has clj backend and cljs (for example reagent + reframe) frontend is surprisingly easy IMO. There's just quite a lot of things that can go wrong in the process and it helps when you already have some knowledge of the parts being used, got some troublesolving skills etc. IMO, the biggest problem with clojure/clojurescript ecosystem is that it's easy to get distracted and try to learn too many things at once. This process of learning takes time and needs some patience IMO.

Tomas Brejla14:07:31

Btw if I was to start learning clj/cljs again from scratch, I'd watch "on the code again" series on youtube They're nicely done, short, fast... yet they still (interactively) introduce a lot of important concepts. I really like what Daniel is doing.


guys keep in mind that I come with absolutely NO experience in web development. What is obvious for all you seasoned professionals for me was an experience running from pillar to post and going nowhere fast.... 😄 I am in a better place now.


I am sure I was doing something stupid... I wish I knew about clojurians back then... I could have asked you folks... but I didnt...


"In the end, setting up shadow-cljs project that has clj backend and cljs (for example reagent + reframe) frontend is surprisingly easy IMO. There's just quite a lot of things that can go wrong in the process and it helps when you already have some knowledge of the parts being used, got some troublesolving skills etc." Can you point me to a tutorial on this?


the structure of the project when using lein is different to clj to boot... and comon guys, this is hard as a new beginner!! Especially if you come from a background of C/C++ like me, where the project structure is a lot more fluid... ok maybe more familiar...

Cora (she/her)14:07:57

when I was learning I struggled with this stuff a lot, too, and I wasn't even using clojurescript on the frontend

Cora (she/her)14:07:55

I got lucky, in a way, that I was using spacemacs and then doom emacs at the time since it made emacs setup for clojure so easy


I felt that emacs is one of the biggest stepping-stones for newcomers. Whoever I heard of trying to get started with clojure entered a book (e.g.) Brave Clojure where the first step is setting up Emacs. I don't think anyone I know made it past the emacs chapters. I believe if tutorials would start with setting up VSCode or Intellij beginners would already have a smoother ride. The confusion about the tools as lein/boot/deps I felt quite a lot too, I'm now happy with just using deps.edn

Cora (she/her)16:07:43

I don't think setting up emacs is the way to go, no way. it's such an investment to get started with

Cora (she/her)16:07:05

I'm lucky that I was already using it, so I didn't have to invest at all


In my beginnings it really looked like you needed emacs to program Clojure from all the tutorials and I almost didn't make it past

Cora (she/her)16:07:30

I've heard people having decent luck with Atom as an editor for Clojure, too, but VSCode has a huge community and tons of momentum, it seems like the natural thing to recommend

Cora (she/her)16:07:26

intellij is really good but it's complex and cursive requires licensing as soon as you use it for anything commercial


VSCode and Intellij are the two editors everyone in my company and all others I had contact with use so yes, there is a big bunch of the devs (Especially web) - well, at least in my country

Cora (she/her)16:07:49

it's all intellij and emacs for clojure, and vscode for some people for typescript and other languages, at my company

Cora (she/her)16:07:14

if calva supported good vim bindings out of the box I'd probably just use that 😅


I'm using VSCode for Clojure after some initial tries with intellij. Calva rocks 😎

Cora (she/her)16:07:07

I should probably just unlearn all my vim muscle memory again


I'm using VIM bindings (NeoVim) in VSCode and have no issues 😄 only very few rebindings were necessary to make paredit happy with hjkl

Cora (she/her)16:07:00

oh wow, this is much more helpful than they have been historically

Cora (she/her)16:07:12

"This is a call for someone to share their VIM re-mappings"


I can DM my mappings to you 😉

Cora (she/her)16:07:05

I really want to give it a try

Cora (she/her)16:07:10

thank you!!

👍 2

I sympathize with @U022LK3L4JJ about frontend/full-stack development in Clojure/Script. There seem to be three approaches: the very minimal stuff documented on (which doesn't seem to get you past "Hello, World!"), the node/npm-centric Shadow-cljs setup (which seems to assume a lot of familiarity with JS/node that I don't have -- and don't want to have), and Figwheel Main (which certainly seems to be the simplest to me -- as a backend developer).

👍 2

I don't think frontend/full-stack is easy at all in cljs. I think backend clj is much, much easier to get setup and running. I've attempted to learn cljs several times over the years (my first attempt was back in 2014 I think) and it is certainly getting easier but it is still pretty darn complex and confusing. The last time around (last year), I ended up with a Figwheel Main/`re-frame` setup that I quite liked when I was using Atom/Chlorine, but I haven't tried again since I switched to VS Code/Clover (with Calva for editing/formatting/linting etc).


And I certainly do not advocate anyone trying to learn both Clojure/Script and Emacs at the same time! OMG! Stick to whatever editor you're already familiar with, if possible, and just add Clojure integration to it. I can't stand IntelliJ but a lot of people like that and Cursive is an amazing product at this point. The Calva team have also done an amazing job and I heartily recommend VS Code + Calva as another good option to start with. Only if you're already confident with Emacs would I recommend using it while learning Clojure!


@U6JS7B99S I'll take any pointers ... mappings or otherwise...

Tomas Brejla18:07:22

I'd say that booting into cljs is not that hard as it used to be anymore. I found especially shadow-cljs very useful. Working mostly as a backend/integration java developer,since 2007, I didn't have much trouble booting into cljs+reagent+reframe and was able to build and deploy a (rather simple but useful) web app in couple of days. But I have to admin that I already tried to do some using that stack in recent year or two. But never anything serisous. @U022LK3L4JJ > Can you point me to a tutorial on this? (web development tutorial with cljs/reagent/reframe) Check this on the code again video: It will show you how to create a simple web app - in interactive way. The basics of both reagent ( "react") and reframe ( "redux") are not too hard to understand. But be aware that by jumping directly to this area of development, you risk that you might "skip too many chapters" (and improving your problem-solving skills in new language/platform) which could assist you in your daily development.


@U04V70XH6 See this thread I have an issue with figwheel-main... do you know anything about this?

Tomas Brejla18:07:09

and as @U04V70XH6 said: > I don't think frontend/full-stack is easy at all in cljs. I'd say it's that web development in general is quite hard. And not only in cljs, but in js, typescript,... you name it. Too many technologies to learn, everything permanently changing, too many libraries full of bugs, too many tools...


@U022LK3L4JJ I don't do cljs so I've no idea about stuff like that.


oh ok... worth asking


@U01LFP3LA6P I agree: the frontend world is insane -- I am full of admiration for our frontend team at work... the stuff they deal with is just mind-boggling (and they're doing straight-up JS with React.js/Redux/etc).

Tomas Brejla18:07:40

Btw in fact I believe the most "easy-to-start-with" solution for playing with regent/reframe/cljs might (in the future, not now!) actually be borkdude's scittle 😄 For example this is the ultra-basic example of "full-stack" guestbook. 1 clj file for backend (can be served using single babashka binary) and 1 cljs file for frontend. But this solution, while exciting, is very experimental and you will be missing a lot of great features (such as solid REPL integration), would you actually try to code something this way.

Tomas Brejla18:07:42

I am super happy with shadow-cljs. Didn't take too long to get the basic "skeleton" of the application up and running, hot reloading of both the cljs code and css files works superbly,.. very satisfied. I also tried figwheel-main for the same app. Made my app working in the end, but "the road was a bit more bumpy", I'd say. Both alternatives are great, I just found shadow a bit easier (and better documented) for my journey.


Hello deps.edn masters, i want something equivalent to Leiningen's `:injections` option, to be used with a deps.edn Alias in other words, i want to execute a piece of code, whenever i fire a REPL with that profile, how can i do this?


I wrote up an example of that here -

👏 2
👍 4

you don't need the commas in the last alias there now, that's been fixed since

Antonio Bibiano14:07:40

hello everybody, what's a good library to parse HTML? I once saw a suggestion for XML, which was to use and but I was curious if that's the best way for HTML too


no, probably not. there are great Java libs for this and it's probably easiest to use those


jsoup is one well-known one

Antonio Bibiano14:07:27

oh thanks i'll look into it 🙂

Daniel Getz17:07:11

Hi! is there an Wordpress analogy in Clojure?

sb17:07:23 ? If I remember good they use Clojure..

👍 2

But that isnt opensource


@daniel.z.getz Not really. Clojure's target market tends to be bespoke software solutions. If you want something like Wordpress, just use Wordpress: it does a great job for packaged software.

👍 2

Yeah we use Wordpress on a sub domain. Gets the job done in a pretty pain-free way.


I’d like to master the transducer, I get the general principle I think, but I could use some exercises to practice on


Have you watched the original transducer talks by RH? Those were very useful for me to grok the concept.


@U3ES97LAC how about: • create a set of transducers and use them on a collection and a channel • write code that takes a transducer as an argument to modify its behavior • create a new transducing context (that is, something that uses a transducer in the same way a channel or collection op would, without converting to a channel or collection first)

👍 2

@U3ES97LAC Did you mean “master the transducer” as in use existing transducers, or write your own?


In any case, I agree with @U051SS2EU. After you watch some talks and get just enough of the idea, practicing the concept is the best way to proceed.


Ohh, rf is a function passed into the input arguments


so you can invoke it with (rf) … I was quite confuzzled for a sec there!


I would love to see line-by-line commentary on core.clj


The thing that made it click for me the best was on the transducer page of A transducer is a function from a reducing function to a reducing function


Hmm, neat, I’ll have to ponder that.


that line is a fn body


generally you see fns like (fn [x] x)


but that is shorthand for (fn ([x] x))


where ([x] x) is a fn body, an arg list and a body


and a fn can have multiple fn bodies


(fn ([] nil) ([x] x) ([x y] [x y]))


so that fn can be invoked with 0, 1, or 2 args