Fork me on GitHub

Is there a shorthand syntax to define a map having a keyword with the same name as its value? For example in JS I'm used to {foo} being shorthand for {foo: foo}


No. But that seems to be a common question from folks used to JS.


Ok, thanks!


There was a discussion in ClojureVerse about this @andrew513 which I think resulted in some macro - but most people shied away from it.

Roman Chvanikov09:04:37

Hi, can somebody explain, what’s the meaning of keywords :user or :repl in .lein/profiles.clj? I’m feeling confused since some tutorials says something like “put this to the file: {:user {:plugins [[cider/cider/nrepl "0.21.1"]]}}" while others show exactly the same but with :repl instead of user as a top-level keyword. Also, I believe I’ve seen other options, not only :user and :repl, so where do I read more about it?


this document talks about those two profiles and everything else

Roman Chvanikov09:04:57

seems what I was looking for, thanks!


how mto make map eager? :thinking_face:


for what purpose? it's possible to define map using reduce, which is eager


(defn transform-each [f coll]
  (reduce #(conj %1 (f %2)) [] coll))

Alex Miller (Clojure team)11:04:24

You can use map as a transducer with something like into, which will be eager

Alex Miller (Clojure team)11:04:09

(into [] (map inc) (range 10))


By eager I assume you mean non-lazy? if so then use mapv rather than map i.e. (mapv inc (range 10))


alex's example is eager here. It is using (map inc) as a transducer. There are some added performance benefits to this method as well


This is such a beginner question, I'm having a problem figuring out what I ought to even ask... but I'm working on something from exercism, which included a project folder with a project.clj and src and test folders. I'm able to run lein test to run the built-in tests to see if my functions work correctly. However, when I run lein repl, I try to use (ns beer-song) to enter that namespace, which happily goes along, but I can't seem to access any of the functions in that file. I'm guessing I'm somehow misunderstanding the module system maybe, anything common I'm neglecting?


that'd be (require 'beer-song)


and then (in-ns 'beer-song) if you want to set it as the current ns


Perfect! Thank you, that moved things along. If I go and change something now and save the file, do I need to re-require or do something else to have the new code be used in the given repl?


your editor should help you with that. in cursive I alt-shift-L to load a file into a repl or alt-shift-p to load a form


you can use too


I'm using cursive on a mac, where would I see that configuration for shortcuts


in the contextual menu you can find a "REPL" item that lists some common actions


see #cursive too


@kamuela If you want to re-configure the load-in-repl command, check in Preferences under Keymap -> Plugins -> Cursive -> Load file in REPL


@twaima I found this instructive on async programming -- the tl;dw is, Don't completely discount promises as a way of handling async programming


that bicycle there is representing that, maybe core.async is a finely tuned and expensive racing bike, and promises are a easy-to-maintain fixed gear


i thought it was interesting

👍 4