Fork me on GitHub

Does anybody know of a wiki/tutorial for Chas Emerick's pomegranate?: Also how do you guys usually explore a new library? How do import all dependencies into the repl if possible?


In terms of looking at new libraries, making a local playground that has all the dependencies and such can be a useful starting point


Looking at the project's source can also be useful, especially its tests if there are tests. Then you can see how it's meant to be used


You can also search for usage of the project on Github and see how other people are using it

michaelwfogleman11:09:02 is a good tool for that last tip


I like the lein-try plugin for stuff like that, you give it a library and it downloads it and fires up a repl without needing to go through a lot of project.clj ceremony:


@U5GP7SDN2 Thanks for the suggestions.


@U08QZ7Y5S I just tried lein-try, it seems like a very handy tool 🙂


I'm supposed to implement a function that is tested by this:

(let [test-clock (clock->string (clock 24 0))]
      (is (= test-clock "00:00"))))
What is the ->string thing here? Is that just a naming convention? Like I should define my function defn clock->string [clock]?


it's a clojure naming convention, clock->stringmeans clock to string


Thanks. i didn't know if the -> was some sort of special keyword


I suggest reading elements of clojure by ztellman


the first chapter covers this


(also it's great)


Thanks for the reference. I'll probably pick it up when I have a little bit more experience under my belt.

Jim Rootham15:09:33

Is there a way to configure httpkit to handle CORS? Or do I need to use something else (jetty)?

Jim Rootham15:09:04

Found a SO post that says no. Off to track down jetty.


Just realized this isn’t the work slack 😄 But the ring.middleware.cors bit still holds. This might be what you want?

Ben Redden17:09:29

after a bit of trial and error, realized I only had the JRE installed and not the JDK, but was up and running once that was installed; i’d always been kinda against Java up until now.. not sure if it’s because my only experience with it was when a friend showed me some Android code and tons of XML files


yeah - “best practices” in the java ecosystem can easily make you hate the language, but it’s possible to use it in more reasonable ways


at least for me I always found the excessive boilerplate code to be annoying. I also had a terrible teacher so both things tainted pure Java for me


working with JVM is cool though


Hi. Just curious, but is there a more idiomatic way to achieve the same result for (apply str (reverse "abcd"))


(clojure.string/reverse "whatever") would be pretty idiomatic i think


Now wondering what clojure.string/reverse is doing under the hood 🙂


(.. (split "") (reverse) (join ""))
after handling some unicode things it seems


Looks like it's using Java's StringBuilder, using the Java reverse function, and then using .toString


Am I looking at the wrong bit of code?


nope that's correct. the clojure.string one will be faster than a generic sequence operation


i'm not sure. i'm a little confused now. i navigated to the impl in my editor


ahh, i was in a cljs version. my apologies


No need to apologise 🙂


(apply str (reverse "abcd"))
that code ^ is creating a sequence of java.lang.Characters


clojure.string/reverse is defined in target/raw/jib_out/js/clojure/string.cljs.


from my editor


which explains the lack of stringbuilder usage 🙂


I really need to spend some time going through sequences in more detail


my version of the tl;dr is that they act like linked lists (regardless of what they have under the hood) and most of clojure.core knows how to use them so they lend themselves to simple general code (which is good) at the cost of performance (which is less good but it depends on what your actual bottle necks and such are as always)


so with the StringBuilder vs. seq of characters comparison, it’s the difference between code optimized to build a String in memory with a data structure optimized for that purpose, vs. a linked list of Object that just happens to carry instances of Character and then using str (which finally does the StringBuilder thing under the hood itself)


Anyone have an opinion on choosing between Atom or VS Code with Clojure?


VS Code (unfortuately) doesn't seem to a have a good Clojure plugin (with REPL and so on), whereas Atom does. I was previously using VS Code, tried using Atom, but it was very unstable and generally unusable in my experience, so have been using Emacs (IntelliJ is also good).