It's from Robert A. Heinlein scifi book "Stranger in a Strange Land".
In the novel native martians do exist and they are very smart. "Grok" it's the martian word for "water" and "to drink". Water is a scarce resource there, and, like here, very important for life.
Drinking is putting water inside you but also occurs that this water becomes part of you.
Then, in that society, drinking is used as the metaphor for understand something in a level that becomes part of you.
I'm a native spanish speaker and I don't know if that word sounds bad in english, but for me the metaphor is so powerful and beautiful that I like it very much.
I have been so conditioned by posting on HN to not reply with the banal, 'this', or, 'good one', that it almost seems wrong to just say, 'thank you for that post'.
Perhaps it's just been by a series of improbable coincidences that in the years I have read forums, IRC logs, books, and articles, I've only seen the term here on HN.
Could be a case of Baader-Meinhof [1], or maybe you haven't been socializing in right forums. The word "grok" has been in popular use on Usenet since the early 1990s at least, probably before, since it's from a 1970s Heinlein novel.
In simple terms, it goes through the array, and calls the named function on every element. You could read it as - "For this array, invoke the 'remove' function on every element."
that's funny, I'm the other way around.. whenever I see syntactic sugar implemented via javascript, I unroll it in my head and consider it overhead, compared to sending a bunch of more bytes down the wire which hardly matter after gzip.
Underscore uses native methods for map/reduce/forEach when possible. For a modern browser the performance difference is comparable, or even faster for a map than an unrolled for loop:
And TIL stands for what, exactly? Sure you would not simply equate "syntactic sugar" with "syntactic sugar implemented in javascript".. so what are "TIL javascrip functions"? I tried searching, but no luck, woth none of the permutations. There are too many acronyms for TIL to just blindly guess.
They were attempting to use a meme acronym sarcastically -- an example of content-free commenting that works well for karma elsewhere but hopefully doesn't gain a foothold here.
On topic, I agree with your amplification of your point.
I guess while syntactic sugar is usually considered a functionality of the language itself, it surely is used in the way I meant it, too... random search result:
I can get where you're going with this, but as someone who uses underscore everyday I have to say in this particular case I don't agree with you.
Underscore as a production library is 4kb. The functions are terse, and its extremely easy to understand what they're doing - nothing is generally hidden (this example is pretty easy to understand, yet one of the most "complex" uses of underscore I've seen).
At the end of the day on a production javascript app of multiple thousand lines of JS, it likely actually saves me bytes over the wire from not having to write "for(var x = 0...." every time I want to iterate through something or filter an array or find if an array includes something etc (There's around 70 bytes removed in this single example).
Well, of course it matters how often you do it. I would not do it in loops, or often called event handlers, such as scrolling. If you do it once on page load, sure, it hardly matters.
But if you do it a lot in your code, that just means you can easily copy and paste it from a nearby place? At least that's what I often end up doing.
I've been using underscore for a few months and had no idea that you could call _ as a function until today. Pretty amazed that I missed this all along. Thanks for this!
for(var index = 0, length = listItems.length; index < length; index++) { listItems[index].remove(); }
and I think to myself -
_(listItems).invoke('remove')