This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-20
Channels
- # beginners (43)
- # boot (44)
- # chestnut (17)
- # cider (78)
- # cljs-dev (24)
- # cljsrn (16)
- # clojure (84)
- # clojure-dusseldorf (1)
- # clojure-italy (21)
- # clojure-losangeles (2)
- # clojure-russia (140)
- # clojure-sg (2)
- # clojure-spec (8)
- # clojure-uk (16)
- # clojurescript (23)
- # cursive (7)
- # datascript (1)
- # datomic (18)
- # docker (20)
- # ethereum (1)
- # fulcro (16)
- # garden (4)
- # graphql (27)
- # hoplon (9)
- # jobs (4)
- # luminus (34)
- # off-topic (6)
- # om (4)
- # onyx (35)
- # pedestal (3)
- # re-frame (24)
- # ring-swagger (15)
- # rum (6)
- # shadow-cljs (22)
- # spacemacs (8)
- # specter (22)
- # yada (7)
Does anybody know of a wiki/tutorial for Chas Emerick's pomegranate?: https://github.com/cemerick/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
https://crossclj.info/ 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: https://github.com/rkneufeld/lein-try
@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]
?Thanks for the reference. I'll probably pick it up when I have a little bit more experience under my belt.
Is there a way to configure httpkit to handle CORS? Or do I need to use something else (jetty)?
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? https://github.com/r0man/ring-cors
just purchased this course on Udemy https://www.udemy.com/learning-clojure/learn/v4/overview
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
Hi. Just curious, but is there a more idiomatic way to achieve the same result for (apply str (reverse "abcd"))
Now wondering what clojure.string/reverse
is doing under the hood š
Not https://github.com/clojure/clojure/blob/master/src/clj/clojure/string.clj#L48-L52 ?
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
No need to apologise š
(apply str (reverse "abcd"))
that code ^ is creating a sequence of java.lang.Character
sI 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)