Archive for the ‘Serious’ Category

lggers

Monday, June 21st, 2010

Have you ever seen people say things like “O(lg n)”?

These people are bad people.  Say “O(log n)”.  It sounds like you have a vowel disorder when you say “lg(n)”.  Oh, what’s that?  You want the binary logarithm function?  Well it doesn’t matter when using O notation.  Stop bothering to specify the base of your logarithm (unless it’s in an exponent, of course).  And if you’re outside of O notation, or inside an exponent, what should you use?  Should you use lg(n) then?

No, you bad person, you shouldn’t!  Say log2(n), you big baby. Or if anything, say lb(n). That way you’re being all “logarithm, binary.” It doesn’t sound like you’re trying to strangle yourself when saying it. How in the world does “lg” come to mean log base 2? It makes no sense. You are a bad person if you do that. lb(n) is pronounced “blog of n,” by the way.

Seriously, if you use “lg” on a regular basis, you should get yourself checked out, psychiatrically, OK you know what? NEW RULE: Firefox shouldn’t be trying to spell-check me if it doesn’t have a complete dictionary. It’s giving me the red underline with “psychiatrically.” Is there a way to turn this off? Oh, there is! Now, where were we? Ah, yes, get your self checked out psychiatcicrally. Thanks.

lb(n) is just so much better than *shudder* lg(n). Using lg is practically racist, because instead of being a logger, you are now a lgger, and who knows what vowel goes between the l and the g?

At least you aren’t saying “ln(x)”. The lawn of x. Yawn. And then.. the “ln(ln(x))” or lon lon of x. Zelda humor!

Property Rights and Inertia

Saturday, May 1st, 2010

Property rights are kind of weird.  When you own a piece of land, what do you own?  How do you figure out what land you own in the future?  What if there’s an earthquake, and the land shifts?  What about continental drift?  Do your property lines drift in the opposite direction by a few centimeters relative to the ground every year? We conveniently ignore these questions.

What about space?  Suppose you owned a region of space.  An unmoving region of space.  Wait, what?  All regions of space move.  Our galaxy is moving and stars are orbiting the center of the galaxy (and rearranging themselves) at not exactly the same speed.  Suppose you own an asteroid and all airspace within 3 light years, and some other guy does too.  Your asteroids fly past one another.  Your properties overlapped!  This is a bit contradictory.  How would we develop a system of describing property rights for regions of space?

Fuckin Hacker News

Saturday, May 1st, 2010

LOOK AT THIS

They just fucking discovered e^(i*pi).

They’ll let anybody post these days.

Past tense of alloc

Wednesday, April 14th, 2010

Suppose you do this:

    [NSString alloc]

Did you alloc an NSString? Yes, you did. You “alloced” the string? Or is it that you “allocked” the string?

I think allocked is the past tense form of alloc. Otherwise, you’d be pronouncing the word “allo-sed,” which would be dumb.

Also, mallocked and callocked and reallocked.

EYE

Tuesday, April 13th, 2010

It’s really annoying on the internet when you want to be a flagrantly egotistical person and talk about YOUR opinion and what YOU think about things. And the reason that is so is that you have to talk about not what “YOU” think about things, but what “I” think about things.

And since “I” is already capitalized, you can’t shout it. You have to emphasize it through other means. Italicizing it doesn’t really help, since it’s a single letter, and embolding it doesn’t really work either, it just makes it look like some kind of monolith from Space Odyssey 2000. You can’t give it external underscores or asterisks, as in _I_ or *I*, because the former looks like a perpendicular or “bottom” symbol and the latter looks like some kind of mechanical diagram with gears and such. You can’t use /I/ either, because that’s sort of like a l33t-speek N.

So, what do you do? What do you do?

Perhaps you should say “EYE” to shout the word “I”. Well EYE think that’s a horrible idea. Aye. Maybe we should adopt the practice of using lowercase “eye” in place of “I” or “i” when chatting in IRC. When people ask why, you could point them to this blog post. Make a link.

Holy Moley There’s So Much Stuff To Learn

Wednesday, April 7th, 2010

Every once in a while, I realize that there’s so much stuff I need to learn.  I need to learn how to generate code for the x86 instruction set.  How to make music on the computer.  How to do computational geometry.  Materials science.  Quantum physics.  How can I not know quantum physics?  Honestly, I barely even know multivariable calculus.  And I’m not comfortable with tensors.  I never have been!

I’m terrible at learning, but I’m good at remembering.

There’s just so much stuff I haven’t learned.  The only math I know is the kind useful for high school math contests.  I really know my 30-60-90 triangles and will never forget them.  I’m good at thinking carefully under brief spurts of high pressure not lasting more than 3 hours.  However, I’ve lately been developing into a panic because of how little I know, and how little I’ve learned, despite meaning to learn it for several years.

When I look at my interests, there is the difference between what I want my interests to be versus what they are.  In my 6th semester of college, I took a lighter courseload so that I could spend more time on personal projects.  And what did I do?  I muddled around with Haskell.  But what I wanted to do was to muddle around with math and compilers.  But I didn’t!  I muddled around with type systems.  Blah!

I barely know how to write software.  Oh hey, I want to make a software project…. and how do I do that?  I worked for 1.5 years as a programmer and I’m still fuddling along, going at a snail’s pace.  Why don’t I have the energy for this?

Do I need more exercise?  I’m going to go out and exercise right now.  I’ll be right back.  And then we’ll see how my attitude has changed.

Well!  It’s amazing how far you can run when you haven’t run for the past week and a half and you have all that stamina built up.  It’s amazing how much heavier you feel when you’ve been eating a fair bit in that period of time.  Well I’m going to take a quick shower.  And then we’ll see how my attitude has changed.

What I’ve found is that when exercising, particularly when running, that after exercising, my thoughts tend to get scattered and that they tend to go testing themselves in all sorts of different tangents.  It’s as if all sorts of different whimsical departments of the brain have all gotten reactivated and decided to call up the center of consciousness and decided to tell it what it might want to think about.  And then the center of consciousness has to cut them off and listen to other upshoots of ideas, and then cut them off.

While running, I started to think about what causes me to have opinions about things and what causes certain opinions to be written down.  You see, back when I was a teenager (I’m 23 now), I used to freely publish my opinions online.  But then, as I turned 17 or 18, I started to notice that I wasn’t a fan of my previous opinions, because my opinions had changed.  They had gotten older and more mature.  And so I got a sort of Vulcan-like persona online.  I became all logical and restricted my thoughts to matters of fact.  You see, I couldn’t leak dumb thoughts online that my older and more mature self would feel embarrassed about, when it remembers their leakage in the future.  But then, later, I felt embarrassed about how I had somewhat bottled my online self up in the past, and how this must have been a mark of immaturity, or something, and so I spent some time feeling that way.  And lately, with this blog, I’ve decided to become unbottled, and reveal my true opinions.

But what are my true opinions?  What does that even mean?  Presumably, it means that somewhere inside myself, there’s a person that has opinions, and that I just have suppressed them and have decided not to leak them.  And so my “outer” layer of consciousness has operated under the rules of, “take the inner consciousness’s opinions, and filter them.”  Lately, with this latest blog, though, have I simply let the inner consciousness’s opinions out, or have I encouraged the inner consciousness to develop ridiculous opinions and let those out?  Or has my outer consciousness decided to embellish the inner consciousness’s opinions and satirize them to an absurd extent, and write those down?

I’ve recognized, in the act of writing this blog, that to some extent, this blog has been a satire of why my true opinions are.  (And there we are back again to that central question: what are my “true” opinions?  When I’ve just drank a lot of soda, I resolve to drink only tea.  When I have refrained from soda for a while, I feel that one or two or six sodas would be a tolerable indulgence.  What is my true opinion?)  That is, I recognized, as I wrote the opinions down, that they are to some extent a satire of what my true opinions are.  Or are they a satire of what I imagined my true opinions to be?

The trouble with having opinions and memories of opinions is that you can never really tell what the true cause of your opinions are.  Often, when you come up with opinions or reasons for your opinions, you’re just telling yourself rationalizations for why you have certain opinions.  Or at least I think that’s the case for you — I know it’s the case for me, and since you seem to be human, I’m assuming you’re similar to me.  For example, when deciding not to go to grad school, I came up with all sorts of rationalizations.  And I don’t know which are the real ones.  If any of them are real.

So, when talking about the notion of “true opinion,” I mentioned that there might be some “inner consciousness” that had opinions on things.  And I mentioned that when cooling down after exercise, all sorts of departments in the brain would chime in to the center of consciousness about things they’d like to blog about.

What I’d like to know is: how do the different departments of the brain know that it’s time to think about certain things?  Like what to blog about?  It seems to me like the center of consciousness sort of broadcasts to other parts of the brain “Hey, I’m thinking about this, would you please send me ideas if you have them?”  And then the other parts respond.  Some parts are particularly specialized.  Reading, writing, face recognition, are fairly well-hardwired.  Back in high school, when I was spending a lot of time with RPN calculators, I got really good at mentally simplifying complex expressions, because I would just keep a stack of numbers in my head and pipe the argument through some parellized RPN version of the expression I was evaluating, or some near-RPN version that was more like a direct expression tree computed in parallel.  I have definite memories of deciding to compute x*(y+z) into x*y + x*z in parallel, rather than sequentially.  So anyway my point is that the brain obviously does stuff in parallel, and we can learn to do multiple things at the same time, like piping numbers through equations while listening to and parsing the words of a person speaking and pushing a buzzer.

And it seems to me like that if there’s an “inner consciousness,” located somewhere in my brain, that has its own opinions of things that my “outer consciousness” filters or exaggerates or whatever, then there’s a separate center of consciousness operating there.  And so there’s a person there — a mind! — that would like to do and say things and that always gets frustrated because its opinions and decisions never get acted upon.

And I think I’m that mind, and that there’s some outer center of consciousness that filters things.  And I think the outer center of consciousness, and me, the inner center of consciousness, both can manipulate memory.  And so the inner and outer centers of consciousness, looking back on their own memories, think that it’s their decisions that caused them to do the things they did.  And so they have no direct evidence of one another.  So there’s no way to tell whether your mind is the inner or outer center of consciousness.  They are only slightly out of synchronization.  So my decision that “I’m the inner center of consciousness” is a complete contrivance of opinion, and isn’t based on any observation.  And of course, the outer center of consciousness has let this opinion through, and so apparently it thinks it’s the inner center of consciousness.  Or maybe the outer consciousness decided that it would add this sentence about a complete contrivance of opinion.  Or maybe the inner center of consciousness managed to flip the controls and outmuster the outer.  I of course can only remember having thought of writing that, since my memories are mixed in with the other center of consciousness.

And of course, why are there only two?  If anything, there should be as many centers of consciousness as there are points in space.  Each of them is a product of an infinitesimal neighborhood of the brain receiving and sending information.  Some are smarter or duller than others, and all of them have a separate center of consciousness, or “mind,” arising out of them.  And so there are minds formed everywhere in the brain that all have opinions on things, and some of them are minds formed out of parts of the brain that get to control things, and maybe others are minds formed out of parts of the brain that are dead ends.  That are mostly overlooked.  That don’t really matter.  And so you get minds that have opinions on what to do but then immediately forget that they had such an opinion (since new information is coming in that didn’t depend on the production of that opinion) and then have new irrelevant opinions.

So there’s a good chance that my mind is completely irrelevant, and that there’s a mind a micron away that is really the master of everything.   But what about these memories?  If the same memories of thought are getting pumped through every part of the brain, it seems like every center of consciousness would end up being more or less equals.  Since they’re all mixed together, they’re virtually identical.  Of course, many parts of the brain do specialized things.  So it seems like they would have separate, duller centers of consciousness.  Somewhere there’s a 3D imagination center of the brain that imagines 3D things and calculates accelerations and frisbee trajectories.  It has a jolly good time, when it gets some use, and doesn’t concern itself with worldly problems.

Well, I hope you enjoyed this silly blog post.  It’s stuff like this that makes me a panprotoexperientialist.

Goon Project

Saturday, March 27th, 2010

I’m going to break from my habit of scheduling most posts at 5:00 AM and instead intend to go for a more brutal pattern, one of posting at least once in any 24 hour period. I’ve decided to start a little project to make a little iPhone app that I have wished the existence of for a little period of time. It’s going to be the usual sort of forum reader software like “Forums” or “Forum Pro” or what have you, except that it won’t suck, it’ll use a proxy server with a relatively custom protocol (probably just gzipped json or equivalent), for the purpose of lowering bandwidth and for the purpose of being able to add support for new forums that use weird skins or structures whenever it’s needed, so that users can complain and have their problems resolved instead of having to give up or wait for an update. (And I guess I better check if that’s allowed, according to the app store policies.)

My postings will be about what I’ve done in the previous sub-24-hour period. This will force me to actually get stuff done.

I have made my first decision about this project already.  I’m going to use PLT Scheme for the server end.  Part of the reason is that I just read this comment by boskone on Hacker News, basically saying,

IMHO, there are currently only 2 top tier active hotspots where the cool theoretical meets with the practical and usable in programming language theory, the Haskell and PLT ecospheres.

Well that’s very sweet.  Anyway, I think it deserves a leap of faith, especially since, if I ever decide that I really want a statically typed language, I can just go with #lang typed-scheme.  So I will try it and report back on my trials and tribble-ations with PLT Scheme.

Edit: tribble-ations? Sigh.

Fuck!

Saturday, March 27th, 2010

Every time I use Clojure,
I want to use Scala.
Every time I use Scala,
I want to use Clojure.

forzan’s razor

Friday, March 19th, 2010

A lot of times you might decide that you disagree with somebody, or perhaps somebody decides that they disagree with you, and so you end up in some sort of argument, on the internet.

What should you do in this situation? It depends on what your goals are. Let’s assume you’re a selfless enlightened individual. You’re only interested in increasing the correctness of people’s opinions, including your own. What should you do? Let’s be more specific: What should you do when you find yourself in disagreement with me?

When I argue on the internet, I’m not a particularly charitable arguer. Here’s how arguments with me go, when on the internet:

Other Guy: A is true.
shrughes: Have you considered that B might be true?
Other Guy: No it’s not.
shrughes: Yes it is.
Other Guy: Prove it.

That’s not an argument, it’s contradiction.  What went wrong here?

What went wrong is that the Other Guy didn’t consider whether my opinion might be correct.  If you find yourself in a contradiction session with me, you’ll find that I don’t consider it my sacred duty to find and give you supporting evidence or rationale for my opinions. I expect you to see the evidence and rationales yourself. What am I, your slave? I think not.

When you find yourself arguing on the internet, you have to realize that people arguing with you, who are trying to convince you to change your opinion, are doing it for your sake. They’re trying to get you to see the light. They don’t owe you their time, and if they’ve offered you another opinion to consider, that’s friendly of them. You’re responsible for the correctness of your opinions, not they. If you are unconvinçable, it’s your problem.

forzan’s razor:

Other people’s opinions are to be held to a standard of
rigorous proof, because they are not mine.

Don’t fall for forzan’s razor. Recognize that your opinions are reducible to either an irrationally chosen set of axioms, a nest of circular reasoning, or an infinite chain of increasingly complicated statements. Recognize that you, a human being, are doomed to subjectivity, and don’t cry when people point out the stretch marks on the surface of your reasoning. Heh, stretch marks.

On Point-free Style

Monday, March 8th, 2010

With a blog posting and then with some people sperging about the posting on Hacker News, I feel it’s time to write a post on the utility of point-free style, or “point-less” style as some call it.

One Hacker News poster, hristov, apparently reporting live from spergatory, had this to say:

First I would like to say that I am only learning Haskell, and have done nothing but toy programs thus far. But the point free style is something that I really do not like about Haskell. It makes code much more complicated for the dubious benefit of saving a couple of keystrokes.For example, take the code from the article:

This is without point free style: sum xs = foldr (+) 0 xs

And this is with: sum = foldr (+) 0

You have saved a total of 4 keystrokes. And made that line of code look really weird and hard to understand.

Thus, now when you look at code you cannot say at first glance how many arguments a function takes. The second line of code looks like sum takes 0 arguments. But you have to look more carefully at the definition of the function, and see that it uses foldr, and know that foldr takes three arguments, but here only two are defined, and then you figure out that someone is using point free style and then you figure out that sum, actually takes one argument that must be a list.

And this of course, is a simple example. Here we have a big clue in that the function is defined with zero arguments, and most functions take at least one argument, therefore the function probably uses the point free notation. But for a more complex and longer function, the point free style can very easily confuse someone reading the code.

So yeah, I think point free style is one of these annoying features of Haskell, that seem to be put in so that users of Haskell can pat themselves on the back and feel like they are very smart. But in the end it does not add much to the language and makes it much less accessible.

I have no idea whether this is a common form of misconfigured worldview.  Anyway, the Hacker News poster is right, and the blog poster is a bad person for confusing him.  (This shouldn’t be surprising, because blog posters who put a “Conclusion” section in their posts tend to be bad people.)  But where the Hacker News poster is right is where he says that using point-free style for top level definitions is pointless.  He’s sort of right.  He’s right because it is pointless.  The definition sum xs = foldr (+) 0 xs is generally more readable to everybody than the definition sum = foldr (+) 0.  It does no harm to write out the parameter, and it does make things more clear, because you’re advertising the arity of your function.  It helps anybody who’s new to your codebase.

But it’s not as bad as the Hacker News poster makes out, which is why his worldview is misconfigured. It’s not so bad when you see

sum :: Num a => [a] -> a
sum = foldr (+) 0

It’s not!  You have the type signature right there.  It’s basically standard to put type signatures on all your top-level functions.  And when you do that, it’s not so confusing.

Both the blog poster and the Hacker News poster are missing the more useful applications of point-free style, which is for the purpose of passing parameters to higher order functions and for avoiding horrible nests of parentheses.

For example, when solving Project Euler problem 62, the easiest way to tackle it was to chain a bunch of list manipulation operations together.

minimum
. head
. filter ((== 5) . length)
. concat
. map (groupBy ((==) `on` sort) . sortBy (compare `on` sort))
. groupBy ((==) `on` length)
. map (show . (^3))
$ [0..]

We have a ton of point-free examples there.  It is natural to use point-free style and function combinators for everything there.  If we didn’t, it would look like this:

minimum
 (head
  (filter (\ns -> length ns == 5)
          (concat
           (map (\xs -> groupBy (\x y -> sort x == sort y)
                                (sortBy (\x y -> compare (sort x)
                                                         (sort y))
                                        xs))
                (groupBy (\x y -> length x == length y)
                         (map (\k -> show (k^3)) [0..]))))))

How do you like that?  The parenthesis management is horrifying.  We could, then, make one small baby step towards point free style, and bring back the big chain of function composition, without touching the parameters we pass to map, groupBy, sortBy, and such.

minimum
. head
. filter (\ns -> length ns == 5)
. concat
. map (\xs -> groupBy (\x y -> sort x == sort y)
                      (sortBy (\x y -> compare (sort x)
                                               (sort y))
                              xs))
. groupBy (\x y -> length x == length y)
. map (\k -> show (k^3))
$ [0..]

An alternate baby step would have been first to make the parameters in point-free style.

minimum
 (head
  (filter ((== 5) . length)
          (concat
           (map (groupBy ((==) `on` sort)
                 . sortBy (compare `on` sort))
                (groupBy ((==) `on` length)
                         (map (show . (^3)) [0..]))))))

But really, we should just go for the best of both worlds.

Conclusion

The blog poster is dumb for making a blog posting about point-free style and demonstrating with top-level functions.  The real benefit of point-free style is for making function parameters and avoiding big gobs of syntax.  But don’t hate on the blog poster, because he doesn’t say wrong things.  The Hacker News poster is excused, because he’s a newbie to Haskell, and he’s reacting to the blog poster’s examples.  He also gets a pass because you can tell he’s generally an immature retard, which we know because he says, “You have saved a total of 4 keystrokes,” as if keystrokes was ever the point. Go count your lines of code, son, and when you’re done counting them, then maybe you get to make grandiose generalizations about the users of and an emergent property of a language you don’t understand.