Fork me on GitHub

anyone know why

(binding [*provided* (merge provided args)]
          (map (bound-fn [x] (walk! x)) children))
works, but
(binding [*provided* (merge provided args)]
          (map walk! children))
loses the *provided* binding?

Lennart Buit05:01:31

Huh, don’t you mean (map #(walk! %) children) in the second case?


oops, had a typo. I meant (map walk! children)

Lennart Buit06:01:03

Right, I had a case of ‘early morning’ and forgot about passing unary fns directly

Lennart Buit06:01:08

With the chance of sounding stupid: could it be because your map returns a lazy sequence and therefore the binding is lost when it is realized


:thinking_face: I wouldn’t expect it to, but maybe


this is something that happens. Lazy sequences might be realized outside of the scope of the binding.




hrmph. I changed it back to (map walk! children) and it works

Lennart Buit07:01:08

haha, sometimes you have those problems


Is there a way to define a function or variable that belongs to another NS?

(defn another-ns/foo [x] 3)
(defn another-ns/bar 5)
2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling src/---.clj at (14:1)
   #:clojure.error{:phase :macro-syntax-check,
                   :line 14,
                   :column 1,
                   :source ---
                   :symbol clojure.core/defn}

1. Caused by clojure.lang.ExceptionInfo
   Call to clojure.core/defn did not conform to spec.
                        [{:path [:fn-name],
                          :pred clojure.core/simple-symbol?,
                          :val another-ns/foo,
                          :in [0]}],
                        #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x32a67584 "[email protected]"],
                        :value (another-ns/foo [x] 3),
                        :args (another-ns/foo [x] 3)}


I'm trying to use the clj-ipfs-api ( but I cannot load any NS that refers to its functions without having an IPFS daemon running. Ideally, those functions would just fail if I tried to call them without the daemon running, but I get exceptions because the vars haven't even been defined. My workaround is to check if the functions have been defined (using resolve) and replace them with a dummy function (that throws if called) if they're missing.


in-ns before the def ?


but beware that if the proper file for the ns is eventually loaded, the ns won't be strictly new so iirc it won't implicitly refer-clojure.


Hi, IntellijIdea and Cursive users, how do you make Idea to recognise HugSQL functions?


you can ask in #cursive or #sql channel.

👍 1

Hi, I have a hex string that looks like 01031000BB014727DB00000064009600C823C5 that I need to decode in to something human readable. Whats the best way of going about this? The first three bytes are meaningless but after that I need to read 2 bytes at a time?


(->> (.getBytes "01031000BB014727DB00000064009600C823C5")
     (drop 3) ;; The first three bytes are meaningless
     (partition 2) ;; I need to read 2 bytes at a time
     (map (partial byte-array 2)) ;; Turn (1 2) back to byte[]
     (map slurp)) ;; turn byte pair into string again 


Using transducers (performatic)

(into []
      (comp (drop 3)                                        ;; The first three bytes are meaningless
            (partition-all 2)                               ;; I need to read 2 bytes at a time
            (map (partial byte-array 2))                    ;; Turn (1 2) back to byte[]
            (map slurp))                                    ;; turn byte pair into string again
      (.getBytes "01031000BB014727DB00000064009600C823C5"))


Nice one! thank you


share the final form 🙂


I thought Buffy may have helped out but can't work out how to pass the whole string in.


anybody got a quick and easy way of writing a file sent through a http/POST to file?


to disk, rather


i'm not quite sure what to use, if there's a convenient clojure library for it, or if I should just go straight to FileOutputStream


Ring seems to not be happy about that approach though; java.lang.IllegalArgumentException: No implementation of method: :write-body-to-stream of protocol: #&apos;ring.core.protocols/StreamableResponseBody found for class:


Is there an abstraction where something like take & drop would avoid computation? I'm guessing it would utilize custom versions of take/`drop`, although maybe txors can do this? I'm thinking about computationally heavy pagination.


Hi, can someone confirm or deny, that gen-class generated code can't put java annotations on generated class methods?


No this is how to attach to the methods you are bringing as new, but if you have methods which are, for example, alerady in super class (like abstract method) and then you try to write the function and attach the annotation, it does not work... Or should I also declare methods in the gen-class itself... I think you only do when you define new onews


I have java abstract class, which I try to extend, and there is abstract method "call" in that class, which I try to implement and add the annotation, in bytecode I see the method, but not the annotation


yea according to doc, the clojure will override all the public methods of super class, when extending, but it somehow clears and ignores all the annotations I put on the extendable abstract method


I am utterly unable to find exampl exactly for gen-class... and not the methods which are new, but just well... extending abstract class, and dropping annotation on the abstract method implemetnation... I know it's possible for deftype (I think)


hey people, anyone know where I can find more details about the mechanics behind the error handler function optionally attached to agents? Specifically, is it dispatched in the same thread as the send which was responsible for the failing call, so that IO should be avoided in that case (or send-off used in cases where the error handler has to do IO)? And is the return value from the error used at all?


Hmm, Clojure Programming suggests it's not handled in the dispatch thread, so IO should be fine 🙂


It’s handled in the agent execution thread, not in the thread calling send / send-off. If doing I/O, I would use send-off. The return value is not used.


hey, don't know whether I'm in the right place for this: i want to make some improvements to but i think it lacks an active maintainer. improvements i think of atm would be • clean up issues/PRs on github • oauth-login (afaik there would already be a PR that needs some love or rewrite, dunno yet) • maybe a small face lift using cljs/reframe? i mainly think of this as an exercise for myself xD but i'd like to accomplish some goals like improvements on "top users"/"follow" page/features (performance-wise) • mabye some browser-editor improvements to name some of the starters


so my question is, who i need to contact to become maintainer and how i qualify to become the next warden of 🙂


@klaus.azesberger I don’t know the current maintainer, but I would also be interested in these improvments. I would also like to add better error messages through the use of speculative instrumentation (can be turned on and off). For browser editor improvements CodeMirror + parinfer could be used.

👍 1

if @danielwithmusic is right amalloy still has ownership. will look into possibilites to reach him and/or any1 on the contributors list tonight.

Sy Borg21:01:50

isn't there a typo?

(doc clojure.set/rename-keys)
([map kmap])
  Returns the map with the keys in kmap renamed to the vals in kmap


if kmap is {:a :b} it renames keys of kmap (:a) to vals of kmap (:b)


it's awkward, but correct


"if a key in m is also a key in kmap, it is replaced by the corresponding val in kmap" is a potentially clearer way to say that(?)

Sy Borg21:01:29

I would expect "Returns the map with the keys in map renamed to the vals in kmap"


no, because keys that aren't in kmap are not touched


I think the tricky issue is tying the keys from map and the keys from kmap together, and what happens when they match.


I like your definition above @noisesmith more than the docstring, which tripped me up when I was first figuring out how to use it.

Sy Borg21:01:26

examples from prove that my understanding is correct, but I'm confused by description


@sy_borg You’re correct, that appears to be a typo


Oh shoot, no sorry


That’s not a typo


haha, it took me a couple of reads to understand the docstring


Running that top example in a clj repl doesn't replicate that behavior.


user=> (set/rename-keys {:a 1} {:a :new-a :b :new-b})
{:new-a 1}


you are missing the :b key in the input map


Sorry, the behavior I was pointing out was that keys in kmap that aren't in map result in no behavior; there was an example on clojuredocs that showed an old behavior where the returned map would contain :new-b nil as a k/v pair.


That being said, upon rereading this thread I'm not sure if anyone was confused about that.


also in the examples that was a bug in clojure 1.1 and fixed in 1.2.1 ti thought i read


Yep! I just like to verify those statements myself...


(too much time working front-line support, perhaps...)

Sy Borg21:01:05

btw, where's


it comes with clojure


(require '[ :as diff])

Sy Borg21:01:53

doc returns nil to me


did you require its namespace?

Sy Borg21:01:28

Execution error (FileNotFoundException) at user/eval1484 (form-init8507139964286056300.clj:1).
Could not locate diff__init.class, diff.clj or diff.cljc on classpath.
sorry, I'm noob

Sy Borg21:01:36

thx Dan, it worked

👍 1
Sy Borg21:01:40

oh, just noticed I'm in the wrong channel


in postgres, column names can't have hyphens (unless you escape them). I'm using hugsql and I'd like to create some middleware to convert snake_case keys to kebab-case for every query, has anybody done this already?

Eccentric J23:01:31

There’s an exploit in Slack that allows you to change permissions and post as random user ids from the client side. Occasionally a troll comes in and uses it to post as random people and start something.


that's a pretty serious exploit

Eccentric J23:01:39

Yes, yes it is. They disclosed the issue but apparently refuse to fix it.


@noprompt the admins have disabled that, the troll was using a well known exploit in slack


slack is very aware of it, and has not fixed it


This is the same exploit described previously?


I wonder what the rationale is for not fixing it.




Stop discussing this here. Go to #community-development for that discussion please.


#clojurescript has also been hit


Thanks. I'll join there and clean up.

Eccentric J23:01:46

Oops sorry 😓


Do not engage the trolls. Do not discuss it in regular channels. It just makes the noise worse.