21,186 karma · joined Oct 12, 2010 (16y ago) · 6,050 submissions
Personal site: http://www.adityamukerjee.net/
My email is pretty easy to guess from my username.
comment 14y ago · link · parent
... I'm not sure if that supports or contradicts your point....
comment 14y ago · link · parent
I half-wish that there would be a way to teach a compilers class as the second class in a CS track (ie, right after the intro class), but the problem is that it just requires too much familiarity with the details in order to impose upon most beginner/intermediate students, even if a few really interested ones could potentially handle it.
It might be easier if you started off with Scheme and then went from there (a la SICP), but even then, you'd miss a lot of the more fundamental concepts assumed in the Dragon book that really just need a lot of time to be digested.
[1] Alright, there's probably a three-way tie for 1st, but it still counts. My education would not have been complete without it; I highly recommend the Dragon book to anybody who has the time and interest.
comment 14y ago · link · parent
Keep in mind, we're talking about a single website (among many) with a proprietary, non-open, non-free codebase, so the contrast shouldn't be surprising.
If we were talking about a similar-but-open-source service like Identi.ca, this would play out very differently.
comment 14y ago · link · parent
If that were the case, then what do I care if people are using a different program to open them?
comment 14y ago · link · parent
What if you pay with a prepaid Visa/Mastercard, since those aren't linked to your name? Or in cash (yes, that still exists!), or via money order (since sending cash in the mail is illegal, and money orders can't be reliably linked to an individual).
comment 14y ago · link · parent
Even if that >50% isn't true (though I believe it is), it helps to put things in perspective - what's Microsoft's larger goal, other than just get a bit of market share in another corner of the larger tech market?
Google and Apple both have visions behind Android and iOS, respectively, even if they're very different visions/goals. I still don't know what Microsoft's driving vision behind WP7 is - that is, if they have one.
comment 14y ago · link · parent
Pedantry is infinitely recursive, with no base case in sight and no tail optimization - my tolerance/stack for these things overflows rather quickly. :-)
But thanks for the link! I'll be sure to check it out later; it looks interesting.
comment 14y ago · link · parent
In the general case, not necessarily for any subset, and this would apply to to non-functional algorithms as well. Just because I write a 'simple' for/while loop, that doesn't necessarily imply anything about the actual
At the end of the day, an algorithm is simply an unambiguous, executable, and terminating specification of a way to solve a problem. We may implement an algorithm by creating a physical or virtual machine that conforms to that specification, but even abstractions like Turing machines and lambda calculi are just attempts at creating a deterministic model that we can manipulate in order to understand the algorithm, which is an abstract specification.
The problem is that in general, algorithms are not specified in perfect detail, or they are implemented in ways that are logicially equivalent, but not exactly equivalent, with the specification. (Or oftentimes both). When dealing with any specific algorithm, we can usually infer that analyses of one will translate to the other, but in the general case, this assumption is murky.
The difference between functional and non-functional for an algorithm happens at the level of the specification, which is different from the level of the implementation. The translation from one to the other involves optimization. And if perfect optimization is undecidable, as you point out, so is the question of whether a perfectly optimized implementation of one class of algorithms is 'better' than a perfectly optimized implementation of another class, since we're no longer dealing with individual instances.
comment 14y ago · link · parent
And at the end of the day, my original point stands: we're talking about writing purely functional code, but if the code is being compiled by a compiler that takes advantage of non-functional code optimization (and as far as I know, nearly all general-purpose compilers do to some degree), then it doesn't make sense to compare the functional code vs. non-functional code. Even if it appears that data structures are immutable, if the compiler is mutating them behind-the-scenes, it all depends on how well-optimized the compiler is, and that's a very different discussion than the one implied by the title.
comment 14y ago · link · parent
If we want to get really pedantic, I guess we could say that we're using one Turing machine (our computer) to emulate another equivalent model of computation (the lambda calculus), so the computer warms up because the Turing Machine is an inefficient emulator of the instantaneously-evaluating lambda calculus evaluator. But the lambda calculus evaluator doesn't change state.
...so, what we really need is to wait for someone to invent a lambda calculus evaluator. Then we wouldn't need to emulate them with these silly Turing machines, and we could get instant evaluations of our programs based solely on ϐ-reductions, with no side-effects (thermal side-effects included). That would put an end to this debate!
(Furthermore, who cares if P=NP if ϐ-reductions can be evaluated 'directly' instead of being emulated by these obsolete Turing machines? Even the hardest decidable problems would be solved instantaneously!)
comment 14y ago · link · parent
Nobody advocates purely functional programming, at least not in the implementation of a language itself, but it can be an incredibly valuable model for a language interface. In the same way, a stack (or better yet, semi-infinite tape) can be an incredibly valuable model for a language interface at well. Functional programming is, by definition, just another way of saying that your model of computation is based on the lambda calculus instead of a Turing machine. You can just as easily ask what the asymptotic 'cost' of using a non-random access Turing machine is.
If people really want a functional language with a purely functional implementation, then you have to say 'farewell' to even things like tail-recursion, since you can make the argument that converting recursion to a loop is anti-lambda calculus.
EDIT: It seems there's some confusion over the distinction between implementing a purely functional algorithm in a language and implementing an language in a purely functional manner. My point is that, even if you implement your algorithm in a purely functional manner, if your compiler is simply converting it to a (well-optimized) imperative, destructive code behind-the-scenes and making it appear to be immutable, then this entire question is rather beside the point. [1] (With apologies to Simon Peyton Jones).
comment 14y ago · link · parent
Would you also refuse to hire an employee who drinks heavily on Friday/Saturday nights, yet never once comes to work drunk? Furthermore, would this even be legal (or ethical)?
Drug testing in the work environment has been shown to be counterproductive for many reasons. Since you seem to care more about the practical impact (not the ethical one), I'll focus on this one: marijuana remains detectable in the system for two weeks after use, whereas most drugs (like cocaine) are undetectable after two days.
So what's the message that you're sending your employees? 'On Friday night, rather than use marijuana, I'd prefer it if you used cocaine or methamphetamine instead.' That way, they'll be sure to pass Monday's drug test, which they'd have failed if they had been 'foolish' enough to inhale from a bong instead of a crack pipe/meth pipe!
So even if you think your employees shouldn't use drugs on their own time, even if it never affects their work, drug testing in the workplace is the worst way to encourage healthy behavior.
comment 14y ago · link · parent
I can't tell you the number of times I've tried to explain to banks that 'security questions' are absolutely worthless, and that their 'secure password' policy is actually worse than no policy at all.
One bank actually requires passwords to be between 6 and 8 characters in length, with at least one letter and one number and no special characters.
comment 14y ago · link · parent
The reason for this is that the USPS can change the zip codes without warning (and furthermore, leaves some areas undefined), whereas the Census needs reliable boundaries and fixed geographic areas.
comment 14y ago · link · parent
Another problem is that the standard becomes irrelevant. This is a concern for HTML5, because a 'rapidly evolving' standard means that things can be added prematurely - but once something is in the standard, it can't be removed (easily). At some point, you run the risk of having more companies go the Microsoft route and just abandon the standard altogether, and either stick with an older version, or just fork it into their own new language.
comment 14y ago · link · parent
comment 14y ago · link · parent
Licensing isn't just a minor thing - getting Matlab to run on non-Debian Linux is a painful ordeal. I never actually got it working, because I never bothered to debug its cryptic error messages, and since it's distributed as a precompiled binary, I wasn't going to sit around trying to patch it. A corollary is that R is easier to integrate into other toolkits, and there are a ridiculous number of freely available R libraries that make your life easier.
My issues with Matlab may be things that someone familiar with the language would care less about. That said, I find Matlab to be incredibly, incredibly irritating, and I think that's because it's design is tailored towards people with minimal experience with other programming languages (like research scientists), whereas R's design is simply based off of S - so I find it violates the Principle of Least Surprise less. Matlab is not like Lisp or Haskell (where the journey of understanding the language is valuable in itself) - it's really just a means to an end (number crunching), so the POLS is especally important.
R, unlike Matlab, imposes almost no restrictions on the structure of a program. The way I see it, Matlab makes Java's broken one-class-per-file model even worse, by imposing more filesystem-level restrictions on my program.
R, unlike Matlab, uses a type system that's more familiar to someone used to programming with multiple datatypes, as opposed to someone used to thinking in terms of strictly numerical structures. I never got the hang of when I should index with () or {} or [] Matlab ... I'd have to look it up to tell you. R, on the other hand, is more like Python in this regard - even if it's not quite as clean as Python, it makes basic things like importing/maniplating CSVs much easier than Python (or even Excel, which is even designed around that exact purpose).
R, unlike Matlab, returns the last value computed, not the last values with the same local names as the return value names.
R, unlike Matlab, uses a more intuitive (to me) definition of dimensions (and of row- vs. column-vectors). I spent 80% of my time in Matlab figuring out how to get dimensions to match in a robust manner, and I've never had to do that in R.
You get the idea - my frustrations with the language itself are mostly with the fact that it's so unlike most other languages, and it's too much of a hassle to learn. My frustrations with the language environment is that the free alternative (R) is much easier to work with, and much more cross-platform.
comment 14y ago · link · parent
I use Python (NumPy/SciPy) for most of the data preprocessing, and perhaps that's why. I used to do this in R, and I realized that it's just a lot easier to get done in Python (and it ends up being faster anyway). The problem is that Python/NumPy/SciPy still doesn't lend itself quite as well as R does to certain aspects of the statistician's use case. It's possible that things have changed since the last time I evaluated the two, but I still find it easier to prototype various models in R, even if I do all of the preqrequisite data munging in a different environment.
I understand that R, like Perl, is 'blessed' (pun intended) with two different, incompatible type systems - in fact, this is the reason I avoid using R's type system, and whenever I'm advising newcomers, I always recommend the same. I don't write statistical packages, so this doesn't come up, but when I find myself needing to write a method in R, I ask myself if this would actually be done more easily another way instead. Generally, I find the answer is 'yes, yes it would'.
I really do think the problem is the type system. The kind of type system that lends itself well to data manipulation is not the same type system that lends itself well to model manipulation - when I think about it, I've unconsciously segregated my workflow into two parts, doing everything naturally done with Python's type system in Python, and likewise for R. Maybe that's just the way that I happen to approach data manipulation, but I think it's non-coincidental. R's relative homoiconicity (compared to Python) makes it really nice for some things, but there are other warts with its typing that are just too annoying to work around, when a python shell is just a few keystrokes away.
I guess the answer is (as always!) to use a purely homoiconic Lisp dialect, so you get the best of both worlds but that's asking a lot of statisticians.
I really have come love R for what it does do, though. Of all all the statistical software packages I've seen (comparable: SAS, SPSS, Stata, MATLAB), it's far and away the best (and the GNU license makes it very, very attractive to broke students looking to avoid the still-absurdly-priced student licenses for the alternatives). That said, I still sigh every time I realize that I'm essentially gluing together two separate runtime environments for something that should really be easily integrated. I do what I do now because it ends up being faster than using either Python or R for everything, but it still strikes me as weird that a language so perfect for munging data (Python) can still be so awkward for analyzing it, and vice versa.
comment 14y ago · link · parent
Most 'popular' languages these days are descendants of C in some form, which means that the differences between any two are very small, in the grand scheme of things. (I'm talking about programming paradigms here - I understand that things like running time and library support are real factors, but to me those define the implementation of a language, not the language itself).
Javascript may be different from most C-derived languages in that it promotes certain paradigms that others don't, but to me, it doesn't offer anything as a language that other languages that I like (and use) don't. Prototypal inheritance is familiar to me from Python (yes, you read that right), and functional paradigms (including first-class/higher-order functions and closures) are familiar to me from Scala and Lisp.
If we want to talk about actual implementation and the runtime environment, I'm still not convinced that Javascript has any real inherent advantages over other languages for most of the non-DOM tasks that people try and use it for. Maybe it promotes familiarity with a single language, but I see that as a detractor, not an asset.
So in the end, while Javascript may be 'more than just the DOM' these days, for me, that's still where its use case lies. Just because I can use it for other things doesn't mean I want to; for anything that I want to do other than manipulating the DOM, I can find an environment that suits me much better.
comment 14y ago · link · parent
Correct. For anyone who's rusty on their financial accounting and interested:
Assets - Liabilities ≡ Stockholder Equity
This is the fundamental identity in financial accounting, and most financial statements are really just different ways of breaking this identity down. Usually it's written as A ≡ L + SE, but I find A - L ≡ SE to be easier to explain.
If you receive a cash pre-payment, you record an increase in the assets, but you also record an increase in 'unearned revenues' - a liability account. Your profit is, essentially, the difference in stockholder equity from one period to the next, so you've had no profit or loss so far (as far as the books are concerned, you're right back where you started).
You also record all costs associated with the revenue in the same period as the revenue payment. This is separate from the 'unearned revenue' liability account. That prevents people from boosting their bottom line in a given period by getting a lot of pre-payments, without recording all of the costs that will eventually be incurred by following through on the service itself. (And the prepayment creates an obligation to follow through, which is a liability).
Once you perform the task, you've earned the revenue, so the unearned revenue gets transferred to an equity account. Then you've earned a profit, which is the difference between your cash received (equal to now-earned revenue) and the costs associated with performing the job.
So if you've already incurred the costs but have not yet followed through on the service itself, you're actually making a loss on paper so far, because you've earned $0 in revenue, even if you have the cash on hand.
(This is highly oversimplified, just in case there are any accountants on HN, but I figure any people who missed the chance to take Financial Accounting 101 may appreciate understanding how some of this works. Even if you hire someone else to do the finances of your startup for you, it really helps to have an idea of why two actions that have the same 'real' outcome can have very different effects on your financial health on paper!)