This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-04
Channels
- # announcements (8)
- # beginners (27)
- # calva (8)
- # cider (26)
- # clara (19)
- # cljdoc (4)
- # cljsjs (1)
- # clojure (221)
- # clojure-dev (6)
- # clojure-europe (11)
- # clojure-gamedev (18)
- # clojure-italy (8)
- # clojure-nl (12)
- # clojure-spec (85)
- # clojure-uk (17)
- # clojurescript (34)
- # community-development (1)
- # cursive (26)
- # datomic (16)
- # dirac (19)
- # duct (6)
- # editors (4)
- # figwheel-main (1)
- # fulcro (68)
- # graphql (41)
- # juxt (16)
- # luminus (11)
- # off-topic (30)
- # pathom (35)
- # planck (2)
- # re-frame (18)
- # reagent (20)
- # remote-jobs (6)
- # rum (1)
- # shadow-cljs (37)
- # spacemacs (9)
- # vim (14)
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.
There was a discussion in ClojureVerse about this @andrew513 which I think resulted in some macro - but most people shied away from it.
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 https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md
seems what I was looking for, thanks!
You can use map as a transducer with something like into, which will be eager
(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 clojure.tools.namespace.repl/refresh
too
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 https://www.youtube.com/watch?v=rV1gTJ2wsZg