This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-29
Channels
- # announcements (2)
- # babashka (2)
- # beginners (76)
- # boot (6)
- # calva (7)
- # cider (12)
- # clara (4)
- # clj-kondo (11)
- # cljdoc (9)
- # cljs-dev (21)
- # cljsrn (7)
- # clojure (72)
- # clojure-dev (158)
- # clojure-europe (2)
- # clojure-italy (3)
- # clojure-losangeles (3)
- # clojure-nl (5)
- # clojure-spec (29)
- # clojure-uk (93)
- # clojurescript (40)
- # cursive (7)
- # data-science (1)
- # datomic (28)
- # defnpodcast (5)
- # duct (5)
- # emacs (7)
- # events (2)
- # figwheel-main (5)
- # fulcro (55)
- # graalvm (2)
- # instaparse (1)
- # jobs (5)
- # juxt (1)
- # luminus (3)
- # nyc (2)
- # pathom (3)
- # planck (25)
- # re-frame (2)
- # reagent (4)
- # reitit (23)
- # shadow-cljs (381)
- # spacemacs (6)
- # sql (19)
- # tools-deps (7)
- # xtdb (4)
you'll need to use a tool like depstar or pack, see https://github.com/clojure/tools.deps.alpha/wiki/Tools for some options
Perhaps not idiomatic, but I've seen this library being recommended: https://github.com/sunng87/diehard
Hi, I’d like to download a jpg file using clj-http, but I get 451 error from some specific resource (https://cover.openbd.jp/9784122029576.jpg), from which I can get the jpg file using web browser. Here is my code. Am I missing something?
(require '[clj-http.client :as client])
(client/get "" {:as :byte-array})
It seems they don't like the clj-http user agent setting. You can use
(client/get "
@UCPGSBNQ4 It worked! Thanks a lot!
Hello guys, I wanted to share a small project I’ve done for parsing RSA private keys (https://github.com/davd33/asn-1-parser)! While it doesn’t parse successfully all key, it successfully parses the one present in the project’s root directory. The code has a lot of side effect handling functions, manipulating a bytebuffer. Could you help me figure out some of the ways I could use to restrain the side effects into the least amount of cose possible?
Learn more clojure? Understand ASN.1? I would like to know ways to improve my coding, since I wrote in the beginners channel... If someone wants to help me: thank you in advance !
@UNDFT2492 it's not the purpose of the beginners channel to help you cheating the hiring process
😅 did not want to cheat, but really to improve myself. I found it difficult to find a way to make pure functions with this exercise. Moreover, is getting help from the community cheating? I didn’t know about ASN.1: does that mean I should have abandoned without even learning something? I sent my answers yesterday morning before posting this question. You can verify. But thank you for your public suppositions.
for learning about it, looking at the relevant bouncy castle libraries may provide a better experience. or buddy, even
That’s what I did. My question here wasn’t about ASN.1, rather about the functional approach of my code and how to do better.
hey, it seems like there are only old versions of clojure and clojurescript on the maven repors (https://repo1.maven.org/maven2/org/clojure/clojurescript/) am i doing something wrong? im trying to install the newst version
I think the newest ones are on there?
1.10.520 is the newest ClojureScript and that's there
im always getting Could not find artifact org.clojure:clojure:jar:1.10.520 in central (
^^ that's latest clojure
Hey, all! 🙂 👋:skin-tone-2: Very often, when one reads the documentation for a function, it says that the function accepts another function as an argument or some map. However, how is one supposed to know what the signature of the input function should be or what the keys of the map are supposed to be. Example: https://cljdoc.org/d/fundingcircle/jackdaw/0.6.9/api/jackdaw.admin#create-topics! > Given an AdminClient and a collection of topic descriptors… So how does one know what keys the topic descriptions should have?
Not that I mind reading the source, but I think that such things should be present in the docs, no?
So, essentially, I guess my question is - is it a question of good/bad documentation or is there something I’m missing?
I would say that it should be in the function’s documentation too. Otherwise in the documentation of the library.
Closest I could find in 2 minutes: https://cljdoc.org/d/fundingcircle/jackdaw/0.6.9/doc/jackdaw-streams-api#topic-definition
I work at Funding Circle, and I alerted the jackdaw team about this question - it might help us improve our docs
TDD seems to be frowned on these days in the clojure community but one of the advantages of TDD (in addition to ensuring that the first user of some function is it's author) is that it provides a ready-made suite of examples of how to use some function. When trying to use a new library, I tend to check the test-suite to see if there are any examples there of the function I'm trying to use. Ideally a library gets to the maturity level of something like clojure.java.jdbc and properly documents all the options but there are a lot of libraries in clojure that aren't yet at that level so it's good to know where to look in the absence of excellent docs.
Howdy folx! So I've been on this channel for a while but mostly just sitting back and learning from afar haha. Today though, today I have a question ! I have a hunch that some of you guys are probably involved in the organization of http://2019.clojure-conj.org/ and so this one goes out to you.... I have some questions regarding qualifying for an opportunity grant (I would also like to attend the Intro workshop). On the website it indicates that it is too late to apply... and well... it is admittedly pretty late to apply (whoops, sorry!) lol but I have to ask bc I would really love to attend... Any chance there are any exceptions to be made for a late application? I believe I would be an excellent candidate as am a LGBTQ, young women, self taught student currently ~2 years in. Scheme and clojure were actually my first programming languages!😯 To find out more about me and my coding style check out my blog https://lambduhh.github.io/
I am registered for the Conj, and asked on a Conj-ticket-holders on-line forum of one of the organizers your question, and they responded as follows:
"Thanks for asking. The application deadline has already passed for this year. For next year, the link will be posted on the Clojure/conj website and will be announced by via Twitter and other channels. We also send newsletters to the Clojure/conj mailing list, so if someone would like to be added to that, they can email <mailto:[email protected]|[email protected]> with that request. We also update that list every year after conj so that all 1st time attendees get added to the list."
I know someone was asking recently if someone wanted to buy their ticket, at a discounted price. Not sure if that would make a difference in your ability to attend.
That person looking to sell their ticket is on this Slack as @U8QBZBHGD but they may have already sold it.
@andy.fingerhut what is this online forum you speak of? may be beneficial for me to join
It is one that those registered for the conference are invited to join, before and during the conference. I only asked there because it was easier to find out who one of the organizers was that way. Not open to all, sorry.
All the Clojure technical discussions happen elsewhere, like here on Clojurians Slack. That one is mostly about places to go locally in Durham, arranging board game night, etc. for those attending.
Hi everyone , what is the benefit of binding a partial function to some var
( def some-var (partial some-fn "some-value" ))
vs defining a new function with a closure ? (defn some-var [another-value] (some-fn "some-value" another-value))
with partial binding to a var, we lose the parameter hints from IDE@vachichng consider this example:
(def some-arrays
[[1 2 3]
[4 5 6]
[7 8 9 10]])
=> #'user/some-arrays
(->>
(map (partial clojure.string/join ", ") some-arrays)
(clojure.string/join "\n")
(println))
1, 2, 3
4, 5, 6
7, 8, 9, 10
=> nil
partial
is one of those things that’s not necessarily your first pick for a lot of tasks, but in some cases it’s handy.
imho #() would be clearer there, and I feel it’s pretty much always clearer. but it’s a personal preference
I used to be a big fan of partial
but I'm leaning more to #()
these days.
tbh I’d probably reach for #()
there too, but it was the first example I could think of 😉
I don't know if I've ever used partial
I take it back! I found evidence that I used it at least once :)
looks like I mostly use it in cases where the alternative is #() with %&
(just wanted to represent that partial
does have some love here) ... and it's not that I can even necessarily defend exactly why it's just one of the tools that I learned early on and so I'm just pretty familiar with it.
nothing wrong with using partial
I actually like to think of partial
as my cool friend greg who actually brought his own beer to the party 🤷 haha just thought you folx might appreciate
I have some questions regarding a sample code in "Clojure for the Brave and True"
(def vamp-keys [:name :glitter-index])
(defn str->int
[str]
(Integer. str))
(def conversions {:name identity
:glitter-index str->int})
(defn convert
[vamp-key value]
((get conversions vamp-key) value))
(defn mapify
"Return a seq of maps like {:name \"Edward Cullen\" :glitter-index 10}"
[rows]
(map (fn [unmapped-row]
(reduce (fn [row-map [vamp-key value]]
(assoc row-map vamp-key (convert vamp-key value)))
{}
(map vector vamp-keys unmapped-row)))
rows))
in the reduce section, what order does it resolve?
I am getting a bit confused on the order of resolution, so it is hard for me to understand why they are doing some of the code
Not sure what you mean by 'resolve' here, but can take a stab at explaining it.
The body of mapify
at the 'top level' is (map some-fn rows)
, where some-fn
is most of the code there.
That function takes one argument, unmapped-row
, which appears to be a sequence of some number of elements, I'm not sure what they typically look like, but when that anonymous fn
is called, once per row, first the arguments to reduce
are evaluated, then reduce
is called.
Evaluating (fn [row-map ...
creates and returns an anonymous function.
Evaluating {}
produces an empty map
Evaluating (map vector vamp-keys unmapped-row)
maps the function vector
over both of the sequences vamp-keys and unmapped-row. Given the value of vamp-keys
above, that should return something like ([:name unmapped-row-element-1] [:glitter-index unmapped-row-element-2])
Then reduce is called with those 3 parameters.
Is that anywhere in the neighborhood of what you were asking about?
Yes, I believe so, evaluating the arguments for reduce first makes a good bit of sense, and clarifies it decently. Thanks.
` for code blocks
@christian.gonzalez Ok, thanks
In general, all Clojure functions, of which reduce
is one, and functions you define with fn
or defn
are also, when they are called, first all of the arguments are evaluated, then the function is called with those resulting values. That isn't necessarily true of Clojure macros -- it depends upon which macro, since each can define its own behavior in that regard.
@andy.fingerhut thanks, I appreciate the clarifications.