Hacker News new | past | comments | ask | show | jobs | submit login
Clojure from the ground up (aphyr.com)
248 points by Adrock on Oct 26, 2013 | hide | past | favorite | 84 comments



> I want to convince you that you can program, that you can do math, that you can design car suspensions and fire suppression systems and spacecraft control software and distributed databases,

I know you are trying to help but you need to realize that the whole section, and this part in particular, is incredibly condescending and guaranteed to piss off any female who might be reading you.

You want to help achieve gender equality in the technical field?

Pretend that the gender of your reader is of no consequence and just write your stuff, period.


It's just a small motivational line with no agenda behind it. You have to pick your words perfectly on the internet because everyone is gonna feel compelled to have an opinion about it.


Or, as the person you replied to said, you just don't have to say any of it. The article was a great technical tutorial combined with a unnecessary political screed.


> It's just a small motivational line with no agenda behind it.

Just because you don't see the agenda doesn't mean it's not there. How do you explain that half of the comments in this thread are not about the content of the article but about the mysogyny of its author?


One might argue that the author hasn't done an effective job of welcoming women to coding. One might even argue that the author has misguidedly had the opposite impact than he intended. But claiming that the author is misogynistic seems way overboard to me.

And the fact that people are commenting on the author's agenda could be evidence that people are defensive or in denial that they are part of a system that is biased against women as much as it is evidence that the author maybe hasn't done the best job of combating that problem.


Please apologize for insinuating the author is a mysogynist. I see no other comments that come even close to implying that.


Oh, please. All writing is inherently motivational. Dispassionate writing on the web isn't very inspirational. Write passionately about anything and you'll be bound to piss off some group or constituency. This walking-on-eggshells, I-can't-write-a-line-until-it's-group-vetted stuff kills creativity and makes everything it touches stale.


I do not see how anyone could possibly believe the author is exhibiting misogyny. Perhaps you are confused by the meaning of the word:

Misogyny /mɪˈsɒdʒɪni/ is the hatred or dislike of women or girls.


This reminds me of a comment Morgan Freeman made when an interviewer asked why he wasn't celebrating black history month. Paraphrasing from memory:

Interviewer: So how do you think race should be addressed?

Freeman: Just stop talking about it! I'm not a black man, and you're not a white man.


I agree that the part you quoted could come off condescending, but I disagree with your prescription. We have plenty of resources for learning how to code that make no gender assumptions, and yet we still have a glaring disparity. I see little reason to believe that your suggested solution of writing dispassionately about coding while avoiding elephant in the room of the gender disparity, in a piece meant to address that, is the proper remedy.


Agreed, it struck me as unique that the author says anything about women. I have seen dozens (if not hundreds) of programming tutorials and that was the first one that said anything about genders. The problem is somewhere else.


Avoiding talking about gender in tutorials is not a prescription for fixing the gender gap in tech, it's a way to not make it worse. The fix, IMO, has to happen on a personal level, encouraging individuals of all stripes to try programming or other tech fields, and calling out those who make it harder.


Chillax, man!!

  Pretend that the gender of your reader is of no consequence 
  and just write your stuff, period.
Are you having your period?

Stop clogging this post with your feminist angst. Learn some fucking Clojure or STFU.


Dude you're an idiot. Go fuck yourself. Really.


A lot of this discussion on gender seems extraneous. Learning Clojure is a simple 2-step process

  * stfu
  * learn Clojure


The "who is this guide for?" section seems a bit out of place here in an otherwise technical document. While I appreciate the sentiment, studies have shown that girls/women perform worse on tests if they are reminded that they're female right before they take the test - I would imagine that a similar effect might occur when learning Clojure (for any of the discriminated groups mentioned in the welcome message). If someone has managed to find this page, chances are they already know a bit about programming and don't need a welcome message - no?


Three reasons. First, I want to justify and contextualize the work in the hopes of promoting more like it. Second, stereotype threat is ameliorated by explicit acknowledgement of the effect. Third, I want to challenge implicit assumptions about the audience of technical writing.


"Who is this guide for" usually talks about a certain level of experience or familiarity with different components or systems. I don't see why you'd put anything about gender there.

I am not a woman, but I'm sure a woman would be just as frustrated as me reading that section and going "oh come on, tell me if I should read this article based on what I know, not what sex I am."


I know females in tech explicitly annoyed by the usual statements which start, "I am not a woman, but I'm sure a woman..." Same goes for white folk presuming to speak for people of color, wealthy elites speaking on behalf of the poor, etc. People who are systematically worse than ignorant.

(And BTW, these same people I know occasionally mention HN as a cesspool of reactionary ideologies, mythologies about how the tech/startup industry actually works, and general absurdity. So like most places online, beware the comments section. Then again, it's a great place to discuss the latest nontechnical thing DHH said.)


I know females in tech explicitly annoyed by the usual statements which start, "I am not a woman, but I'm sure a woman..." Same goes for white folk presuming to speak for people of color, wealthy elites speaking on behalf of the poor, etc.

I think it's safer to say that anyone would be annoyed by being treated in a condescending manner.


I can't tell if you're trying to broaden the statement or disagreeing, but I find it more condescending when someone outside my minority is presuming to speak for it than when someone acknowledges the systematic discrimination that we face.


It sounds like the most important piece of information that you need to judge a person's ideas is the list of which protected groups they belong to.


> I want to challenge implicit assumptions about the audience of technical writing.

I think this is the problem other people are picking up on. Implicit in the idea that you need special technical explanations targeted to women is some notion that women have difficulty with "regular" tutorials. What is that notion? Is there a gender bias to most technical explanations? If so, how does it work, and how is this different? Perhaps there is something, but it needs to be stated and applied.

Without making your "we need explanations specifically targeted to women" theory explicit and robust, you just come off as saying "women need tutorials, so I made you one", which is why it comes off as condescending. Worse, since the tutorial seems perfectly "normal", it's easy to think you're just name-checking a concern as intro boilerplate and then writing a totally unrelated thing about Clojure.

The thing is, it's good article about Clojure. It can stand on its own, and women will read it because it's useful and because they want to know about the language. Perhaps they do need a tutorial, but not because they're women.


> Is there a gender bias to most technical explanations? If so, how does it work, and how is this different?

There is a possible answer to this. I'm just thinking out loud here, but hear me out.

There is a huge gender gap when it comes to programming, as we are all well aware of. A lot of tutorials (even some of the more basic ones, I struggled a lot when trying to move on from "hello world", and "Animal -> Dog" style OOP into actual programming, and this tutorial seems to address that (I've not read it yet, so I hold my judgement).

If those two assumptions hold, then it could be argued that: due to the gender gap, we can assume that females who are starting from scratch may not have the base knowledge for "regular" tutorials to fit them properly.

Now: This may not be true. And usually I'm the first to argue that gender, race, etc. should have no impact on technical writing and knowledge sharing. However, nearly every other tutorial in the worlds body of knowledge is written gender neutral, and the gender gap remains.

That statement could be said to be conflating two issues; Somehow I don't feel like tutorial writing is the missing link to fix the gender gap in our industry. But it was interesting to think about, for me at least.


It's an interesting idea: that the real problem is that things are really tough for beginners now, and since women are more likely to be beginners, it hits them harder as a group. But if so, you'd also expect a chorus of young men complaining about their experience in tech too, which I just haven't heard much of. After all, even if women are disproportionally beginners, beginners are still disproportionally men. (Come to think of it, I've never heard a woman complain that all the tutorials suck either.) I'd be curious to hear otherwise, but my impression was that the state of online programming education options are the best they've ever been.

So I doubt your theory. And so it seems that either those tutorials have a more intrinsic gender bias (defensible but needs defended) or the problem has nothing to do with tutorials on the internet and has deeper and broader causes, which is my default position. Or, like you said:

> Somehow I don't feel like tutorial writing is the missing link to fix the gender gap in our industry.


The tutorials are the best they've ever been and the tutorials suck. Programming real world systems still involves a large amount of "suck it up" pedagogy.

I'm not sure what this has to do with gender/race/sexual preference disproportions...


That's an admirable sentiment, but I personally find the section confusing. Perhaps the loose paragraphs that talk about non-white, non-straight and female could be condensed down to something that didn't seem quite as condescending and actuallly was a little more clear -- and put after a paragraph or two that talk about what you are expected to know to benefit from the text?

I don't really mind "being left out" as a straight white male that's been into hard sciences and computers since I was six (before then it was all dolls, if I am to judge by our family albums) -- but it does strike me as a little strange to read an entire page about "who's this for" and still not getting any real information other than that if I were slightly gay, I'd be more in the target audience? What does that even mean?

As a side note, I've never heard the tech/science community nor higher education was discriminating on sexual preference -- race and gender (as largely a function of wealth and old bias) -- yes -- but there's a gay issue as well? If true that's sad, and I'm glad to be made aware of it -- but I still think the entire about-page could do with a rewrite.


You may have good intentions but this article was condescending, destructive and self-serving.

You keep reinforcing these stereotypes about IT that (a) women aren't capable, (b) men are antagonistic towards women (c) they will never be promoted or accepted amongst their peers and (d) there is rampant sexism. These stereotypes are not pervasive, not unique to just IT and simply don't exist at many types of companies in particular many enterprises.

But don't worry women despite all of this you have come to save the day with a beginner's Clojure article that will gain you the respect of your peers. Give me a break.


Give yourself a break.

If you don't like how others are trying to raise awareness or encourage women in IT, then get off your high-horse and do something yourself that you do agree with. Sitting there lambasting others' efforts does nothing to improve the situation.


I'm getting really tired of this "go do something else" argument/excuse. Doing something constructive yourself is not always a solution for someone else doing something destructive. It's like the tu quoque fallacy, only good for getting someone to shut up, proving nothing. Heaven forbid we should try to prevent something bad from happening.


Mentioning that stereotypes exist isn't the same thing as reinforcing them.


Sure - except in this case the author was. By declaring women, minorities, and LGBT folks the target audience of this Clojure tutorial - it implied that they wouldn't be just as well served by a "regular" Clojure tutorial (even though, as far as I could tell - this actually was just a regular Clojure tutorial). I understand that the article was trying to be welcoming, but the attempt just fell flat on its face.


I only skimmed the article until I saw "lein new", so I have no comment on anything before that. But I did want to say that I liked the explanation of the tree structure with the English language example. I think I might steal it. With the respect to framing the article (or others like it you might write in the future) I wonder if you might be able to find a rhetorical strategy that responds to nicolethenerds' criticisms by writing for a specific person who is also a woman rather than groups like Women Who Code. As long as it was somehow clear that it was indeed a woman that you were writing for (I hope you have a female friend who is curious about Clojure!), you might be able to satisfy your three intentions.

Necessary disclaimer: I am a guy and I have no expertise. I am just thinking out loud.


My math and CS classes usually had a lot of non-white students and some female students, and they seemed to do just fine. Some even appeared to be in the top of the class. It didn't seem that Math was "harder for them".

I think you should check your assumptions.


I can't imagine what I'd have to change in my technical writing in order for women to understand it, because I already assume that women are equally capable of understanding it.


An honest question: Why is it so important to have more women in IT? Is it in pursuit of general gender equality?


The simple fact that you have to defend this section should be reason enough for you to just remove it since it distracts from the rest of your document.

You don't realize it but your words are extremely condescending toward women, you might want to ask someone to help you understand what your position about this really is, because from what I read so far, you certainly seem to believe all these stereotypes about women being less capable than men in the computer area, you just happen to be in strong denial about it.


> you certainly seem to believe all these stereotypes about women being less capable than men in the computer area, you just happen to be in strong denial about it.

I certainly don't think that follows from what he has written at all.

While I can certainly appreciate your objective point, and even agree with it, you're making the same mistake you're accusing the writer of: generalisation based on limited information, at least in my opinion.

I think the section is misguided, and conflating two points (the gender gap in programming is unlikely to be because of the lack of "female targeted" tutorials). But I am not so sure it follows that the author is misogynistic.


I know I'm posting this after this article has peaked, but I did that on purpose. Maybe you won't ever read this. Probably not.

Aphyr I really admired you dude until you decided to post extremely graphic descriptions of your sexual activities on Twitter. I unfollowed you because of it, and I assure you it has absolutely nothing to do with your personal sexuality. I would've unfollowed anyone who posted what you did (hint: it was the 'toilet-cleaning' tweet last week).

And now this blog post. My god. Assault against women is "routine" in STEM fields? It's not routine, it's never been routine, it will never be routine. You live in a social media echo chamber that you need to break out of.

You know what the tech community needs more than anything? Thought-leaders who can teach the rest of us important, practical things about the technology we take for granted every day. What we don't need more of: pandering, condescending horseradish. I honestly will not be surprised if I get attacked personally because of this post as a woman-hating or homophobic bigot. This is the level of discourse now, unfortunately. Ergo why I waited until this post had passed its peak to post.

Break out of your dumb echo chamber, it's decreasing your worth as a teacher.


I have really really been getting into clojure lately. It's a functional language that doesn't feel hard to grasp. But it can be way harder to make sane comparisons between libraries and stuff with a community so small but so active as clojure's.

My kingdom for a decent comparison between NodeJS+ClojureScript vs vanilla Clojure (w/Compjure maybe?) for high performance web applications!


If you mean a performance comparison, I would be surprised if Node (V8) outperformed vanilla Clojure (JVM).



Interestingly, your graph shows x86, but on amd64, this is very different [1]. I wonder why is that.

[1]: http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...


Yeah maybe in general but what about a comparison for heavy IO applications? core.async vs node's system?

I really hope Clojure catches on. It's so fun to write in, I'm never going back!


Real quick: I wrote a little json-in-json-out app for working on webapps before the backend is done (first node (express)). Then, later rewrote it in clojure (compojure). They're both on heroku and perform about the same. This is by no means a real benchmark, but does show that node can keep up with the JVM for ridiculously simple apps.

Node version: http://json-mirror.herokuapp.com/ Clojure version: http://mirror-clojure.herokuapp.com/

Also, ClojureScript is super interesting because a lot of clojure libraries will work (provided they're not a Java wrapper library) automatically. Draw backs though? Speed. ClojureScript uses Google Closure to optimize, which brings it close to pure JS speeds, but according to Conrad Barski, the webfui creator, it's not quite there. Check out his presentation though here if you're interested (demos and speed explanations included): http://www.youtube.com/watch?v=HeI5-D7SQe8

CRAP: Should have replied to parent comment, but it's fine here as well.


Thanks! I'll take a look!


I'm not aware of a good reason to prefer ClojureScript+Node.js in general. Maybe if you wanted interop with a specific Node library, but otherwise, Clojure on the JVM will tend to have vastly better performance, and the tooling is better.

For example, until recently ClojureScript's :keywords were just strings under the hood and it required a string compare to test equality. Apparently this is no longer the case due to this commit 2 months ago: https://github.com/clojure/clojurescript/commit/2cef52840fcd... but it shows you the kind of stuff you might run into. In a recent talk I saw by David Nolen, the lead maintainer of the ClojureScript compiler, he brought up multimethod dispatch as something that can still be as much as 100 times slower than the JVM.

As a tooling example, Clojure gives you helpful errors if you initialize records the wrong way:

    user=> (defrecord Thing [foo bar])
    user.Thing
    user=> (Thing. 1 2)  ; correct usage
    #user.Thing{:foo 1, :bar 2}
    user=> (Thing. 1)    ; wrong number of fields
    
    CompilerException java.lang.IllegalArgumentException: No matching ctor found for class user.Thing, compiling:(/tmp/form-init7089728177345913731.clj:1:1) 
    user=> (Thing 1 2)   ; forgetting the dot
    
    RuntimeException Expecting var, but Thing is mapped to class user.Thing  clojure.lang.Util.runtimeException (Util.java:219)
That's good! Especially if you're new to the language. You see where you messed up right away.

But ClojureScript just silently gives you nils:

    ClojureScript:cljs.user> (defrecord Thing [foo bar])
    cljs.user/Thing
    ClojureScript:cljs.user> (Thing. 1 2)  ; correct usage
    #cljs.user.Thing{:foo 1, :bar 2}
    ClojureScript:cljs.user> (Thing. 1)    ; wrong number of fields
    #cljs.user.Thing{:foo 1, :bar nil}
    ClojureScript:cljs.user> (Thing 1 2)   ; forgetting the dot
    nil
This should be a bug report against the CLJS compiler (edit: now it is[1]), and it's probably not that hard to fix. I could fix it. You could fix it. (The CLJS compiler is very approachable and needs contributors, by the way.) But, especially as a newbie, this kind of stuff can bite you. JVM Clojure is more polished.

1. http://dev.clojure.org/jira/browse/CLJS-639


Well that is pretty tempting! I would be inclined to contribute if I was working on some project where it made sense to use ClojureScript. Perhaps in a couple months when I start working on front end stuff I'll have the chance!

Thanks!


> JVM Clojure is more polished.

I wouldn't say that. In this case for instance it more or less just shoves java's error message in your face, you have to translate that back into the clojure you typed beforehand.


OK, I can see the case for that nitpick. Perhaps neither implementation is particularly "polished" in this regard, and the JVM one just happens to fail faster due to a statically-typed host environment. Polished or not, though, the end result is Clojure being more helpful when you make typos/newbie mistakes.


A comparison with respect to available tools for debugging etc.?


That would be great as well!


The guide appears to assume one is on Mac OS X or Linux without explicitly stating as such (unless I missed it, in which case my bad). That's not good for a world where most people programming on a desktop are on Windows (Mac user myself).


The linked leiningen page includes detailed installation instructions for all platforms, including a windows installer.


Nice guide! Is there more coming? I also loved your explorations on network partitions, keep up the good work!


Thank you, and yes, there will be more.


mot windows users wouldn't go that far. As soon as they try the "wget ..." command and nothing happened, they quit the "from the ground up" guide.


Good point. Perhaps we need a "Terminal" program for windows that just works, installs the common bash tools for windows, and everyone is referred to.

I say this because if a windows user actually opens up their terminal and types in wget, I'd say they're lucky to give up so early considering that the terminal they're using is straight trash. You can't even make it full screen.


This is wrong on so many levels. There are lots of ways on any given platform that will get you what you want without wget. Since powershell is installed by default since w7 it'd be nicer to just (new-object System.Net.WebClient).DownloadFile or similar. I'm also offended by the bash-referrals as a zsh-user :)


I thought one of the changes in later versions of PowerShell was there is now an internal version of wget? I know when I use the gnu one I have use specify "wget.exe" instead of "wget" (Invoke-WebRequest) but I can't remember when I started having to. Windows 8 perhaps?


In fact lein will use powershell if it doesn't find wget.


Is Cygwin unsatisfactory?


For quick start, light uses it absolutely is.


One can find windows binaries for popular unix commands.


I'd spend a bit more time on this. Beginners are quite likely to have windows boxes, and Clojure doesn't work very well on windows. Indeed, telling them to run lein on windows is a recipe for yak-shaving of the first order. (Don't believe me: try switching to windows for a month.)

I'd recommend a virtual box to new Clojure programmers on Windows.


wget ~/bin "aphyr@waterhouse:~/scratch$ lein repl"


And if you are on a mac, I would the think the preferred way to install would with homebrew (brew install leiningen)


No, no. In fact, last time I checked, the lein docs warn about using brew because the versions may be out of date.


From its README:

    > If your preferred package manager has a relatively 
    > recent version of Leiningen, try that first. 
    > Otherwise you can install by hand:
It's kept up to date: https://github.com/mxcl/homebrew/blob/master/Library/Formula...


The Guide also assumes bash. For anyone who ran any of the github installers (win included) it should work ootb.


I've been playing around with clojure and clojurescript on my Ubuntu laptop for a while now, but according to this guide I'm not ready to get started because I don't have "javac" installed.


It's not necessary for all development, but you'll want a java compiler for later parts of the guide.


Great tutorial, look forward to the next one.

Clojure, and indeed LISP is one of the things I would really like to learn but most of the tutorials have been way to academic in there format. This one so far has been much more focused and clearer on the intent of the language.

Thanks


I was just asking a friend of mine for some suggestions for starting up with Clojure.

I loved your Jepsen series and you communicate on a level that I can relate to. As such I was thrilled to find your guide at the top of HN.

Keep up the awesome work!


I love the thorough Guide to Programming in Clojure for Beginners: http://blackstag.com/blog.posting?id=5


Maybe you want to try light table. It's a pure gui experience, and is probably easier than setting up lein. Currently free.


I think all noobs should still get lein. (Install it in 1 second with your package manager)

That way they can run `lein new <project-name>` to get the app skeleton created. Then open it with Lighttable.

In fact, anyone that wants to check out the Clojure version of Sinatra/Flask should run `lein new compojure <project-name>` and it'll create it from a template. Then run `lein ring server` from the project root to start the dev server.

Someone happened to tell me those incantations my first day with Clojure and I was instantly productive.


If a newbie knows what a package manager is and has it set up on their system, then they're probably not the level of noob this article is going for.


I haven't messed with light table recently, but even months ago, when I last fired it up, it was a way easier setup to jump into clojure than installing java, clojure, Leiningen, etc.

So I second this idea, especially if someone doesn't have CLI experience and just wants to get cracking at some code.


This first lesson was quite similar to Clojure in fifteen minutes: http://adambard.com/blog/clojure-in-15-minutes/. I find both pretty good, although this seems more promising. Waiting for more!


IMHO, It would be better to seperate two distinct things into two seperate articles. Your view in women in computing and intro to clojure.


Pointers to a good follow up?


I've been compiling Clojure-resources for learning etc. at https://github.com/tazjin/clojure-basics - maybe you find something that works for you?





Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: