Fork me on GitHub

Is there a clojure core function to check if a collection is a subset of another?


Something to do (every? (into #{} coll) sub-col))


This fails if coll contains nil or false.


#(= (set/intersection coll %) %)


my only thought is my route composition is off but i don't know how to do it differently i guess


Perfect. Thanks.


figured it out. if you want to serve some json, don't forget to wrap your payload in the response function


Hello! I'm just starting out with Clojure, following along with the tutorial. I've mostly used vim as my editor before (10+ years), and never written any lisp at all, nor have I tried Emacs for more than a few minutes. Manually setting up all the vim plugins and config seems a bit daunting and distracting from my actual goal of learning some Clojure. Any advice as to how to get up and running smoothly?


Some would advise using a beginner-oriented editor while you’re learning. This seems like a decent list:


@emilaasa I’m using Vim with and it’s all I need


It seems like there’s a #vim-fireplace room here and they might be helpful in guiding you


no need for any other editors


I’ve been coding clojure for 3+ years, never needed fireplace


@emilaasa Also a vim user here~ 🙂 Here's the plugins I'm using now:



I use di( to move things around in vim


oh right, is an absolute must as well


forgot that it’s not built into vim 😄


but seriously, you can go far without any plugins at all


yeah it's how I'm starting out now atleast


I can't write clojure without rainbow parens now..... lol


paredit for me. i don't type closing parens and i get structural editing. it's a necessity


I've attempted to first perfectly configure my vim for the language I've wanted to learn a few times in my life. Usually ended up learning more about how to totally demolish a .vimrc than any actual programming.


haha yeah that is the risk 🙂


better to just get on with it, and add stuff as you go


completely opposite here~ I only type & delete parans in pairs 😄


Yep I think I will do that, atleast I know there is some pretty big quality of life things I should sort out eventually, namely repl connection, something with balancing parens (?) and editing s-expressions


I don't type closing because they are inserted for me when i enter a pair. I kill inside of a sexp so i maintain the invariant of balanced parens


or kill at an opening one


i can't imagine writing a lisp without some type of structural editing capability. also, emacs has a show matching paren that is invaluable to me


I use ProtoREPL (Atom) and Parinfer -- hated Parinfer at first but forced myself to get used to it and now I absolutely love it! Also have the lisp-paredit package installed for structural stuff and indentation.


This is just too cool 😃


Anyone worked thru a book or tutorial that they can recommend? I'll probably run thru the basics, and then try rewriting a small web service (Java Servlet API) in Clojure as a practice project at work, if that narrows down the preferences at all


i like using Atom as well, but i'm coming from JS/front end land, so it's what i know. i've been working through Living Clojure by Carin Meier and really like it. it's workbook-like rather than a reference.


Thanks for the tip jennifer! I usually like the workbook approach better as well


I'll check it out


@emilaasa What have you looked at so far? Clojure from the Ground Up? Clojure for the Brave and True?


Yeah I'm about an hour into Clojure for the brave


Yeah, I've heard good things about Living Clojure.


Brave and True is where i started and it was good for getting on the ground running.


I'd expect the Clojure Cookbook and Clojure Applied to be good follow-on books, if you like stuff focused on real-world problems and solutions.


It's what my boss likes anyway 😃


Clojure Programming was recommended to me as the follow up, so i've got that as well.

Alex Miller (Clojure team)20:08:14

I’ll add a totally unbiased plug for Programming Clojure, 3rd edition, which is available in beta (but with all of the text available as of about an hour ago)

Alex Miller (Clojure team)20:08:38

but also I recommend all of those books listed too


Hmm something fishy about that totally unbiased plug


But that is impossible since it's totally unbiased


to second Alex's recommendation, I've bought that for myself and a coworker at my former company. really excellent book.


Well an author that shows up in the #beginners slack channel is alright in my book, ordering now 🙂


it brushes up against a good bit of java, some of the more bedrock classes, which is extremely helpful for people like me who do not know the java ecosystem


My first Clojure book was The Joy of Clojure but I wouldn't recommend that unless you already have some FP and some Lisp background. My second book was Clojure Programming (Emerick et al).


I've only done Haskell and done my best to keep the companys JS code as functional as possible 🙂


I'm not sure the javascript experience helped much tho to be fair


It did however want to make me jump out the window a few times


JS always makes me want to jump our of a window 😞


Overall, re: Clojure books, there's a lot of good ones out there and only a few duds so you mostly can't go wrong with whatever anyone recommends.


in the reverse, the stuff i've learned in clojure has made picking up the changes in ES6 smoother.


sounds great I'll get a few and see


I have a couple of sample chapters from the original Programming Clojure book and it looked fine but at the time it was using an outdated version of Clojure so I picked (several) others. Now it's been updated and a third edition is coming out, that's going to be one of the most up-to-date books.


I bought Clojure in Action early on and it was written for Clojure 1.2 but not released until 1.3 was out so a lot of it was broken by that, unfortunately (I pleaded with Manning to have the author update it before release but they pushed it to market anyway).


Thanks everyone by the way for being super helpful! These first hours in #beginners can really make a difference for how you feel about a language/community and you all are making it feel great! 😃

Alex Miller (Clojure team)20:08:46

PC 2nd ed was written against Clojure 1.3, but newest is targeted at 1.9

Alex Miller (Clojure team)20:08:19

btw, I am currently seeking a few reviewers for Programming Clojure! having some beginner(-ish) people would be great

Alex Miller (Clojure team)20:08:00

ping me in dm if you’re interested (free copy of the ebook included). heck, I’ll even send you a physical copy at my expense if the publisher doesn’t (can’t remember right now)


I think PC 1st ed was written against 1.1 wasn't it @alexmiller ?


(almost prehistory in Clojure terms now 🙂 )


I just looked at Clojure in Action 2nd Ed (which I also have) and that was written against 1.6 so it doesn't cover some important recent features.

Alex Miller (Clojure team)20:08:11

I want to say it was 1.0 actually


Before protocols? I'm trying to remember what was added in 1.1... Hard to believe how much the language has moved on since then -- but also incredible how stable and backward-compatible it has remained.


For folks new to Clojure like @emilaasa I'll say: don't be afraid to try the very latest alpha features when learning Clojure (`clojure.spec` is incredible in 1.9 Alpha 17!) -- ever since my company adopted Clojure, we've been going to production on Alpha versions with huge success (our first Clojure launch used 1.3 Alpha 7 or Alpha 8 -- and we've been on 1.9 Alpha 17 in production for a while now!).


Last alpha I put in prod was angular 2


many regrets haha


Clojure != JavaScript 🙂


alpha in clojure world is very different


some aspects of clojure have been marked alpha for multiple years


i wonder what's the oldest feature still marked alpha?


Slow language churn feels like a good sign to me.


One of my favorite newish languages is Elm which is notoriously slow to implement anything, very deliberate and thought through.

Alex Miller (Clojure team)20:08:05

almost nothing (other than the new spec) is still marked alpha

Alex Miller (Clojure team)20:08:14

yes, that and clojure.reflect


Is clojure.reflect consciously marked as alpha because it might change, or because it was never fully fleshed out in the first place and never got worked on again?

Alex Miller (Clojure team)21:08:28

the alpha tag was consciously not removed from clojure.reflect in 1.6 (when we removed it in most other places) because it is still subject to change

Alex Miller (Clojure team)21:08:44

so yes, that is deliberate

Alex Miller (Clojure team)21:08:08

I’m not sure anyone ever actually uses it :) one of the reflectors is actually broken in JDK 8 and no one has ever mentioned it

Alex Miller (Clojure team)21:08:41

will be fixed when we remove support for jdk 6 and update asm next


match but not sure if that's part of the sphere we are talking about now

Alex Miller (Clojure team)20:08:44

nah, just talking about core

Alex Miller (Clojure team)20:08:30

*compiler-options* is also marked as alpha, but I don’t think for any good reason


i feel like reducers, except for fold & cat, should be deprecated


It would be nice to have some form of (parallel) fold in core -- I had hoped we'd see that with transducers (but haven't thought that through to see whether it's even a sane hope). The reducers library feels like a bit of a dead end now: it appeared, never seemed to get much traction, and mostly feels overtaken by transducers. /cc @alexmiller

Alex Miller (Clojure team)21:08:27

I would say that reducers is effectively deprecated (but does still have unique utility). there are no plans to (ever) remove the namespace.


Always accretion... 🙂

Alex Miller (Clojure team)21:08:18

and I expect that eventually the ideas of fold will evolve into something - it’s an important use case and will only grow more so


Since this is #beginner, I'd say reducers are easier to grok then transducers, so lazy-sequence -> reducers -> transducers is a good small increment steps to learning

Alex Miller (Clojure team)22:08:02

I find transducers to be easier to both use and implement actually :)


I agree on "use". Not sure I agree on "implement". I'm still a little hazy on when/how the zero-arity version is invoked.


hey does anyone know how to show docs in the Proto-repl?


I’m about to go to a job interview and haven’t used clojure for a while. I’m planning on using it for the code challenges… never done this before so I’m kinda freaking out haha.


(when you're on a symbol and have a REPL running)


do I have to be in REPL? not file?


In the file, but have a REPL running.


It uses the REPL to run the code to look up the docs.


I was missing the comma


If you bring up the command palette (cmd-shift-p on a mac, can't remember on windows) you can just type documentation and see all the keymappings


cool I think I should be alright now. I was planning on using Racket but I think I’ll be more confident with Clojure


So cmd-opt-d works on a mac as well, and ctl-, d should also work


I was just doing ctrl-alt d without comma and it was deleting up to that point


If in doubt, start from the command palette and it'll show the keyboard shortcuts.


And BTW there's a #protorepl channel, if you're not already a member @grounded_sage


Cheers. Yea I started using Atom because I wanted to use Parinfer. Was using Spacemacs before hand. Proto repl is definitely cool. Still unsure whether switching to Atom was best decision. Time will tell I guess


I've been doing a lot of Elm and Elixir recently. Miss the lisp repl


I used Emacs way back (in the 17.x/18.x days) then found my way back to it after getting into Clojure and used it heavily again for a couple of years. I switched completely to ProtoREPL after Conj last year and I do not regret that change.


You think ProtoREPL is on par with CIDER? I am wondering which-one I should try out


It depends entirely on how much of CIDER's rich functionality you are used to in your daily workflow.


Your choice is more likely to depend on whether you prefer Emacs or Atom as your core editor.


One feature of CIDER that I missed at first with ProtoREPL was the ability to have multiple REPLs open but I've adjusted my workflow to where that's no longer an issue.


I get people who are behind emacs, but if there was one and only one thing that I believe hurts Clojure adoption with beginners, its emacs. I wonder how much emacs has hurt lisps over the years even in terms of widespread adoption. If the language won't be familiar, at the very least having the editor be familiar would be nice. Proto-repl I think is leading the way in that direction.


fwiw, Cursive supports paredit and parinfer, is a lot more stable/mature than atom, almost as feature-complete as emacs for clojure dev, and is quite newbie friendly


@bfabry I think the deciding factor there is whether you want an IDE (IntelliJ/Cursive) or an editor (Atom/ProtoREPL).


I could never grow to like IntelliJ back when I was using IDEs -- I tried a lot of different versions and just don't like the UI. I used Eclipse in preference (although I never really liked Eclipse either). For a while, with Clojure, I used Eclipse/CCW.


I find that distinction pretty hard to grasp


emacs usually runs in some sort of project mode, ditto vim, ditto lighttable


I’ve never used a “project mode” in vim fwiw


(and it’s my main editor)


are you sure? if you opened a ruby project and you had one of the "normal" ruby plugins you were


I don’t open projects


I open files


shrug fair enough I guess. though I definitely open files in cursive


I used vim exclusively as a ruby developer for like... 6 years? and I don't really feel much difference between it and emacs for clojure or cursive for clojure


sure - but I don’t have anything in vim that even knows what a “project” is - it could be that many vim or emacs users are using the right extensions to have an IDE, but I don’t think it’s universal.


cwd in vim was pretty much my equivalent to project. not everyone uses it that way, though it's certainly very common


if cwd is a project, ed is an ide


well my whole point was that I don't think the distinction is meaningful...