graue

Joined 14 years ago

Karma
2,897
Submissions
774
Member since
May 13
Just another {Python,Perl,C,JavaScript,Clojure,Lua} hacker. I was in Hacker School's winter 2013 batch. It was awesome.

https://scott.mn

email: scott@<the above domain>

https://twitter.com/graue

https://github.com/graue

View on Hacker News

Recent submissions

Comment · 12 years ago
I do it. I always thought, "What's the harm? Everything important is over SSL these days". Apparently not!
Comment · 13 years ago
Pebble has a timer app that meets all your requirements. I use it for pomodoros, laundry, steeping tea, cooking rice, etc. Unbelievably handy.
Comment · 13 years ago
Think of strings in JavaScript. Those are already immutable:

    var fooString = "foo";
    var secondFooString = fooString;
    secondFooString;  // => "foo"
    
    fooString = "bar";
    secondFooString;  // => "foo"
We set the variable fooString to point to a different string, but the original, underlying string hasn't changed. In JavaScript, we can think of a string as a value.

This is not the case with arrays in JavaScript:

    var firstArray = [1, 2, 3];
    var secondArray = firstArray;
    
    firstArray[0] = 100;
    firstArray;  // => [100, 2, 3]
    secondArray;  // => also [100, 2, 3]
Because we can change the underlying contents of the array, an array in JavaScript isn't a value. It's a place: a reference to a location in memory. The underlying value could be changed at any time.

But, using Mori, collections are values, just like strings:

    var firstVec = m.vector(1, 2, 3);
    var secondVec = firstVec;
    
    firstVec = m.assoc(firstVec, 0, 100);
    firstVec;  // => [100, 2, 3]
    secondVec;  // => still [1, 2, 3]
Instead of modifying firstVec in place, mori.assoc creates a new vector that is identical to firstVec except for the change we want. We then assign the result to firstVec. secondVec is unchanged. We are unable to go in and change the underlying values because a vector is a value, not a place.

The most obvious way to build this would be to deep-copy the entire collection when it's changed, but that would of course be way too slow and wasteful — imagine copying a one-million-long array just to change one element. Clojure, ClojureScript and Mori minimize unnecessary copying using a very thoughtfully designed data structure you can read about here: http://hypirion.com/musings/understanding-persistent-vector-... The short story is that, surprisingly, you get "effectively O(1)" copying when you use assoc.

Comment · 13 years ago
Comment · 13 years ago
Interesting perspective, thanks. I suspect it depends on whether you're more used to langs like Ruby, Python, JavaScript (which are more like Clojure) or Java (which is more like Scala). Coming from Python and JavaScript, and with minimal Java experience, I find Clojure more approachable... but then, Java-style OO is utterly vexing to me.
Comment · 13 years ago
Did you ever look at Clojure? If not, why not? If so, what didn't you like?

While Clojure surely has a bigger learning curve than Go, it's much simpler and more approachable than Scala. I've learned it recently and am an absolute convert. It seems perfect for your use case and you could even skip writing the prototype in Rails because you'll be just as productive in Clojure.

Note that I'm not trying to convince you to change; you obviously found something that works for you. But I am curious if there were obstacles to using Clojure (missing libraries? poor tutorials?) and if so, how that could be fixed.

Comment · 13 years ago
Congrats on your company's success!

However, I'm surprised that you single out a 40-hour work week as though it's something exceptional. Isn't that the standard? I would never consider joining a company that expected me to work weekends. I hope that's not as common as you imply.

Comment · 13 years ago
As a fellow Clojurist, I agree with the substance of what you're saying here but wish you could express it in a more friendly manner. Both your comments essentially say "you're wrong" without educating or adding value. I don't feel that reflects well on the Clojure community, and I'd like us to do better.
Comment · 13 years ago
Comment · 13 years ago
Music. You can have hundreds of thousands of fans and still not be able to quit your day job.
Comment · 13 years ago
It suddenly occurs to me that "startup" is the new "indie", or "viral". It's become a genre rather than a descriptor of the source of the content.
Comment · 13 years ago
It's true that historically "he" has often been used a generic pronoun, but singular "they" also has a long history. I'd start with this Wikipedia article:

https://en.wikipedia.org/wiki/Singular_they

Some object to the usage because:

> Proponents of gender-neutral language argue that the use of gender-specific language often implies male superiority or reflects an unequal state of society. According to The Handbook of English Linguistics, generic masculine pronouns and gender-specific job titles are instances "where English linguistic convention has historically treated men as prototypical of the human species." Words that refer to women often devolve in meaning, frequently taking on sexual overtones.

> These differences in usage are criticized on two grounds: one, that they reflect a biased state of society, and two, that they help to uphold that state. Studies of children, for instance, indicate that the words children hear affect their perceptions of the gender-appropriateness of certain careers. Other research has demonstrated that men and women apply for jobs in more equal proportions when gender-neutral language is used in the advertisement, as opposed to the generic he or man.

https://en.wikipedia.org/wiki/Gender-neutral_language_in_Eng...

Many years ago, I would have agreed with you that using "he" as neuter was correct and therefore preferable to singular "they". I no longer feel that way. I'd attribute that change in opinion to two causes:

One, I'm less concerned with by-the-book "correctness" and pedantry, and more concerned with the real-world effect my words have on people.

Two, I now realize that English is a living, evolving language, and there is no one authority on what is or is not correct usage. What is widely held to be proper English at a given time is a product of who happened to have influence in society at that time, no more, no less.

Also, although this is not what changed my opinion, I find it interesting to note that many of the same people who call the matter trivial will also expend considerable time and effort defending generic "he". If you find it so trivial, why not humor the people who think gender-neutral language is important?

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton