Sunday, December 05, 2010

Continuous Sleep

It's a Sunday.

What's so special about this day, you might wonder. Nothing really, except that I spent most of the day sleeping in, recovering from the sleep debt that I had incurred over the last few weeks.

It's a most strange thing though, to be sleeping for so many hours at a stretch. My mind feels as though it has been living in the dream world more often than in the real world, what with the whole experience of continuous dreaming. That's right, I actually have the ability to dream in a manner where each dream is continuous with the previous. There's also the ability to dream the same dream many times across time, where each time I get more and more control over what occurs, but I suppose that's a story for another time.

So anyway, continuous dreaming. I woke up this morning feeling rather woozy in the head---it might be that I have been running around fighting monsters just a little bit too much, or that gravity has been acting on my head in a direction that is too orthogonal to what it is used to for more than two-thirds of the day. But one thing is for certain though: I do feel a little more refreshed than before in spite of the wooziness.

Anyway, time for my sleep once more, and off to work I go in the morning.

Sunday, November 28, 2010

Looking Back...

It is sort of a strange thing to realise that a year has passed on by once again. This is the second year that I am spending in Singapore after my undergraduate stint, and to a large degree it would seem to be the case that I have more or less fallen into the pattern of life here once again, this time from the perspective of the part-time student who doubles as a full-time researcher. Life is not great, but it is still manageable, with careful prioritisation of the activities that I might want to engage in considering the limited amount of time I have and the limited amount of energy I can bring about to get things done.

It's a truly strange season though, this time of the year. I believe that I was probably feeling something similar at this time of the year last year, but at a level that is probably a couple of magnitudes lower now than in the past, since, to be fair, I was in a rather heartbroken state last time, whereas for now, I'm just in a generally disaffected type of emotion. I'm slowly training myself to not worry about all the things that make me sad/depressed, but like always, the theory is often easier to come up with than the practical implementation of the ideas that surround the issue.

It is not that I have given up completely on love, but that I have come to the rather unsettling conclusion that it is not the right time now. The conclusion is unsettling because on the one hand I might actually try to convince myself that the whole business of love and relationships should not be pursued during this rather limited time period that I am facing, but on the other hand, my emotions seem to be doing anything but. No, I've not fallen in love with anyone just yet, having learnt my lesson about the pitfalls of ``falling'' in love, but there's always this missing feeling of some sort that is within me, as though all the activities that I have been engaged in are not doing anything that is helping me keep my mind away from all these things that keep creeping up on me. I'm not really sure how best to describe the entire circumstance, but this is probably the best way that I can say about things for now.

Life seems to always be a consistent uphill struggle for me, or at least, it seems to be the case. Most people are probably happy to get by with whatever job they could get their hands on with the degree/diploma that they might have, but somehow that doesn't seem to be the optimising function that I'm running on---again we find that I'm taking the path of most resistance, and in many ways, am suffering greatly from the choice. It's not so much that things are impossible to handle (that's simply untrue), but that there's just so much of it that everything adds up really quickly. Time commitment issues are among the worst---at this stage, I'm probably overcommitted in time by at least 40% over what I'm supposed to be working, and there is no such thing as an over-time pay that can be claimed. It's a very tiring thing to keep running forwards at full power all the time, losing sleep and other implements that may actually make the job easier in the long run. Am I just a whiney person on this regard? I wouldn't think so, because I have all the evidence to show otherwise.

*sigh*

I'm not exactly bitter over things now, but I'm really just disappointed with myself; I keep having the feeling that I am unable to put in my best in all the things that I have gotten involved with in one way or another, and that feeling of disappointment is probably more depressing than the fact that I am committing to nearly 140% of my 47-hour work week. Being disappointed in the self is much worse than anything else in the world for the simple reason that it impinges on a very fundamental aspect of the ego: the self-confidence.

Self-confidence is a self-reinforcing concept/property of every normal person. If you do something that you are confident of doing and succeed, your confidence in the matter will increase. Conversely, if you are not confident of doing something and you have failed, then your confidence would have shattered. But in the case where you just keep getting hit with failures to meet one's expectations, there will come a point in time where the self-confidence just keeps reeling back from the high levels of negative reinforcement that one was indeed incapable in some sense of the word.

I just hope that my self-confidence hasn't taken such a blow yet.

Saturday, November 27, 2010

NaNoWriMo 2010! Official Winner!

54,206 words later, I am done. Proved to be a little harder than last year, because I had to compress all my writing in the first half of the month and I couldn't do much for the second half due to all the work commitments. As usual, grab the manuscript from my domain. I'll fill in more details here some time in the future when I have a little more time on my hands.

Sunday, November 21, 2010

Rant

I suppose it has probably gotten to the time in life where one is starting to get more ``boring'' as a general rule of thumb, because I find that I have less and less interesting things that I really want to talk about over here, or even on my other blog. I'm a little less pensieve than before, partly because there's just so much that needs to be done that I have little time to be worrying about other things that might be affecting me, this being November and all. Oh and the fact that every day, in effect, I am mostly working on things alone, just me with my machines in my cubicle, wondering about why something wasn't working in the way that one would think ought to work, only to end the work day with a few queries still left in the mind that needs some more investigation once I reach home.

I have been told by many people about how they can read the various research papers on the buses and the other public transport---I'm not that super to be able to do that. One thing is that I am afflicted by motion sickness, so actually reading anything on any moving vehicle is probably going to cause more grief than anything else. Couple that with the fact that I absolutely adore annotating the text I'm reading, it means the the three hours that I use each day travelling to and fro work are effectively ``dead'' time that I cannot use to do all these readings.

Maybe it is a good thing for me, in a certain sense. Already I'm feeling the effects of being overworked---my mind has been drifting all over the place, sleep has been rather fitful, appetite has been low, irritability has gone up, and I'm seriously starting to look forward to the weekends. This cannot be a good thing considering all that had happened---I've always thought that I was a workaholic, yet now, when faced with the harsh realities of an effective over-commitment of time, it feels as though I'm not as I thought I once was; I was still human with silly human requirements after all. Like sleep and its friends.

I was assured back in my undergraduate years that once I was done with undergrad, life will not be any more hectic. Then, just like now, I knew that it was a lie; it is hardly the case that things will get better over time. If one were lucky, the status quo is maintained and there will hardly be anything that is sworth worrying about any more. But of course, the thing is that in real-life out of that of academia, work is never-ending---everything is ``in the book'' and while you might have access to your ``cheat sheets'' all the time, the fact that you need to consistently be applying all these ideas at least nine-and-a-half hours a day means that at the end of one work day, the sheer feeling of lackadaisicality is just hard ignore.

I supose there is no one else to blame but myself. In many ways, it might be the case that I have been thinking too highly about myself, always setting goals that are so high and hard that most people think that it is sheer folly to even consider, let alone trying to work towards them. Always a need to prove myself, always a need to show something. Maybe one day I will learn how to overcome this character flaw and figure out how to take things a little easier so as to leave myself with some time to actually do the whole ``be alive'' bit as opposed to being a cog in the entire machine.

I started on this post with hardly any true direction---I think this truly qualifies as a rant of some sort. Maybe some day I will get to look back on this, reflect on it, and then learn to laugh if off.

Friday, November 12, 2010

용서 못해 (I Cannot Forgive)

It seems that even I am not completely immune to what goes on in society. Anywhere, here's something I've been hooked on to for the last few days:A very catchy hook; can't resist. Also, the lyrics are rather saddening too...

Wednesday, November 10, 2010

Initial Capitalisation in Vim

To change the words to be of initial caps, first get to the beginning of the word, then type gUl. To continue for other words, just use w to get to the next word, and . to repeat the action.

Tip from here.

Monday, November 08, 2010

The Pariah

I am the Pariah, the Ishmael of the microcosm that I was once a member of. Amongst peers, I am peerless, not because of my irrefutable ability, but because I was a non-conformist. I yearn the closeness of a fellow human being, but abhor the vulnerabilities that come with the association. I wish to be loved, but have forgotten what is like to love. I am the abomination of humankind, the very essence of what it is to be an outcast.

Each time when I thought I was a part of a group, circumstances would always show otherwise. The world I live in is a constricting cube of norms, not all of them understandable, not all of them comprehensible. As the months turn into years, the more I live in this world, the more I wish I never lived.

Many a time, the will to live had deserted me, yet somehow I was denied the sweetness of death by factors all encompassing, as though it were my karmic retribution to be in constant suffering. Surrounded by the temptations of a thousand hedonistic practices, lured by the seduction of the evil twin sisters of the muse, I struggle past each day trying to be oblivious to all that is occurring around, with my steadfast holding of the small spark of determination that stems from my life quest of seeking knowledge.

But with each passing day, I find the winds of change increasing in intensity, and at times, that spark that I hold so dearly to seemed all but vanquished, raising my hopes that my piteous existence would be snuffed out once and for all, only to have them dashed like waves upon rocks, with the spark enfeebled but hardly dead. Oh woe it is to be living the life of the unliving!

My rational intellect was torn asunder from aeons past, through the three times of silliness I led myself into, the same three times where I exposed my heart and all to the cruelties that made the world. And thrice I exposed, thrice I did fall, hard each time, from the uncaring stabs from those I thought cared the most. A year of construction had commenced since the last defeat, and slowly but sadly, the fortress was built anew, with nary a thought for any save for myself.

Me. Myself. I!

The fortress that held the castle of the heart is now desolate of the once warm springs of love and emotion. In the throne of Eros now sits the Dark Lord who ruled the land of the unliving, poisoning the ventricles of the beating heart with spite and rage that burned the blood into a boiling mass of chaos. Gone are the compassion and empathy, gone are the feelings of comfort. Welcome to the despair, to the blackness, to the pure feeling of suffering. Such is the lot of my life.

As I sit here fulminating from the recesses of my soul, I wonder when will my karma of suffering finally end.

Saturday, November 06, 2010

Dealing With Light Tarnish

If you have some metal stuff with light tarnish, consider using toothpaste as a light abrasive to bring back the shine.

Tuesday, November 02, 2010

Statistics for NaNoWriMo

Some useful tools for NaNoWriMo:
  1. Use http://www.nanowrimo.org/NanowrimoUtils/NanowrimoGraph/yourid.png for a nice breakdown chart.
  2. Link to http://www.nanowrimo.org/NanowrimoUtils/ProgressReport/yourid.html for the detailed numerical breakdown. See this for my own breakdown.
Material partially from here.

[Ed: Forget these links for now... there's something wrong with the hosting side on NaNoWriMo. Just use the standard widgets for everything.]

Monday, November 01, 2010

NaNoWriMo 2010

And so it begins again. Current working title is ``Towards Cacophony'' with a tentative genre of ``Young Adult & Youth''.

Track my progress over here (it's the same link as before).

Monday, October 25, 2010

Gurgle Burgle

I know this sounds clichéd, but time really does pass in a blink of an eye, especially when there are lots to be done. Work has been plentiful and is reaching the stage where it is actually beginning to be intellectually fulfilling, not that it wasn't so earlier, it's just that right about now, it does feel more fulfilling than before. In some senses, knowing the direction that I am taking does have a way of providing the self-confidence that I so desperately need.

But of course, at times I'm still highly hesitant and doubtful about what I am doing. Goes with the job I suppose. Life is full of unpredictable elements, and no matter how prepared one is, the best state that one can ever be is to be consoled by the fact that one has at one's disposal resources that one believes will cover the eventualities that one has thought of. The general lack of imagination of humankind in this regard often means that in spite of the very best planning and preparation, there is still a possibility of getting caught unawares.

Anyway, digressions again... I ought to remind myself to quit writing blog entries so late at night. True, the mind is most free from the normal confines of reality at this time, but at the same time, there is a distinct lack of coherence that is ever-present.

Let's try this again.
------
The last two weeks have had a strange effect on me. Ever since I had that stress fracture on my fibula from a rather overzealous and overambitious plan for running (what? that plan overzealous?), I have been mostly confined indoors. Hell, I've even had to stop my Aikido training for this month (and most likely the next also) so that the fracture will heal over.

Folks who seemingly cared for me have asked me time and time again to have it checked out by a doctor, but I know better than that. It's only a stress fracture, nothing too serious, and the best thing that I can do for it is to just rest it well. Casts are not going to be useful in this case at all, and there will be the whole expense associated with the diagnostics required to confirm what I already know from day eight onwards. Not that I find the concern annoying... I'm just not used to being cared for by folks that way.

So with two more evenings of the week freed up temporarily, I suddenly find myself with time that I can spend on introspection, which is at times a refreshing process. I like introspecting, it is sort of my way of getting some therapeutic effect through the whole ``thinking it through'' process. Of course, many of these thoughts are only for my consumption, and so I will not even allude to them here.

Okay, I've exhausted my words for the day. Next time.

Monday, October 11, 2010

Mucking with enumerate

To alter the starting number for any enumerate counter, use the following
\setcounter{enumi}{n-1}
where n is the starting number you want your list to show.

Note that there are enumi, enumii, enumiii and enumiv to handle the four-level nested enumerate environment.

Sunday, October 10, 2010

Underlining Package for LaTeX

If you want to use underlining (standard or wavy) or strikethroughs in LaTeX, consider adding
\usepackage[normalem]{ulem}
to your LaTeX source file. This opens up the following useful commands:
CommandDescription
\uline{foo}Underlines foo
\uuline{foo}Double underlines foo
\uwave{foo}Underlines foo with a wavy line
\sout{foo}Strikesout foo
\xout{foo}Crosses out foo with `/'
And don't forget that you can use \emph{foo} to obtain an italicised version of foo.

These are preferable over \underline{foo} and {\em foo} because they can handle the edge cases of spanning multiple lines (for underlining) and the space correction after italicisation (for the emphasis component).

Sunday, October 03, 2010

Self-Interest and Altruism

Once upon a time, when I was much younger and full of ideals, when I was mostly segregated from the rabblement that comprised individuals too haughty about their ways to listen to or even pay attention to someone who looked a little different from them, I believed in altruism. From the many levels of education that I was receiving in those days, my conviction towards altruism was strong, wilfully sacrificing myself should the situation arise if the overall benefits were to outweight the costs of self-sacrifice; in some ways, this is the very definition of utilitarianism since it weighs the value of the outcome given the cost of the action.

But as time went by, my disillusionment with the world grew, and slowly but surely, I found myself starting to believe less and less in altruism. In fact, I would say that the events that occurred scantly a year ago are probably what triggered my general lack of belief that altruism is a worthy goal to pursue, for the simple reason that people are not morally rational. I think I'm beginning to understand what the sages were trying to say when they proclaimed that each generation of society was on a spiral of destruction, with each successive generation falling ever lower compared to the last. And as an observer, I have started to see this occurring even as we speak. And the strange thing is, I can see myself as being a contributor to the entire fiasco.

Self-interest and altruism seem to be polar opposites of each other---it is hard to be acting in a way that is consistent with both self-interest and altruism. Granted, one may operate in a way that aligns most of one's self-interest with altruism, but in most cases, this is merely a facade. Altruism is an idealism that attempts to reconcile the actions of the leaders with the welfare of the people---it is a means of showing why a leader does what he/she does by putting the actions into a new light that it is somehow helping the greater good. But are the actions' intent really for the greater good, or is it a by-product of careful engineering on the presentation of the actions? That is one question that few would dare to answer, simply because the intent of any action can only be deduced, and the deduction is probabilistically true at best, since it is hard for anyone to actually understand the innate circumstance that governed the cause of action of any one person.

So is self-interest incompatible with altruism? That is a question that is plaguing me for the better part of the year. As I have noted earlier, I began with the thought that I would be willing to do anything for the greater good. But I have been shown that my assertions were not demonstrated in the real world, and slowly but surely I find myself working from the perspective of self-interest more than anything else. To a large degree then I find that self-interest is incompatible with altruism, since the intent from which the actions they spawn are polar opposites.

[Ed: This started out as a rant on Oct 03, but by now I have no idea where I wanted to go with it, so I'm just leaving this half-completed monstrosity online.]

Thursday, September 30, 2010

Seriously, Your Kind Extinct Liao...

Mm. Just the right time to be writing things once more I suppose. But what shall I talk about today?

The thing about writing a personal blog such as this one under the kinds of NDA requirements that I have with regards to my job means that I can't really talk about the things that happen to me during the 12+ hours that I spend at my workplace, not unless I want the proverbial fine-toothed comb to be run over my posts each time I hit the ``publish'' button. As noted, this can be a substantial amount of time we are talking about here, and thus my posts tend to gravitate towards things that I do outside of work, which can be reduced to probably just a couple of paragraphs or so.

Thankfully, I don't run a blog that is so popular that I have to worry about readership rates and things like that. So at the very least, I have some level of freedom in what I want to talk about here and how I go about doing it, while, of course, observing some prudence in judiciously applying self-censorship to keep the hound dogs at bay.

But of course, what I have said so far is mostly drivel. Now for some fun stuff.

I injured my leg recently from being too gung-ho in the warm-up round for my 10km in 30+week campaign. On the one hand, the chiropractor (or was it the osteopath?) said it was just my bashing of my muscles without proper warm-up before running, but on the other hand, I have that nagging suspicion that a hairline fracture involving the fibula is at work, but lacking any X-rays and first hand information on how a hairline fracture feels like, I can't say more. Actually, on the topic of hairline fracture, I think I had suffered one before a long time ago when I was in secondary school, when I was still rather naive about the world and was being rather altruistic, but that's another story for another time.

Right, injured leg. Because of that, it was annoying to keep standing on it, and so I decided to not take the public transport home. That meant that I had to wait till at least 8pm before I could hail a cab, because of all the extra surcharges from using taxis during the peak period (I believe it is a surcharge of about 15% on top of the meter fare, which is just plain nasty when you need to commute from one end of the island to the next). And so I stayed back in office to clear up some stuff for tomorrow and counted down the time.

Again I think I'm saying a little too much without getting to the main point.

So I managed to get a cab, and told the driver my home address so that he can take me there. And, you know, being a cab driver and all, we had a conversation of sorts.

``Got a route you want to take?'' He asked.

``Not really. Pick any one that works for you. As long as I get back home, I'm fine,'' I replied.

``Eh, you should know the route better what. Just give me a route lah, not all drivers know how to get to the places that the customer want leh.''

``Well... start from Farrer Road then go via Upper Serangoon?''

``Okay.''

And then the conversation drifted towards claiming for cab fare.

``Wah, so late then you go home. Can claim right?'' He asked

``Should be, but I'm too lazy,'' I replied, a little tired from the day's work.

``Wah lau, you are crazy. Most people will want to claim when they leave past 8pm already.''

``Yeah, but I don't usually do this; only once in a long time. It's not that big a deal... just need to eat less for the next few days since I need to lose some weight after all.''

``Ooo ngia borh, you need to lose weight? Can claim don't want to claim? Sure or not... very rich is it?''

``Not really. Just find that the paperwork for claiming is just too much effort for something that I do only once in a long long while. Seriously, I need to lose some weight after all.''

``Man, people like you, extinct already!''

And of course the conversation went on and on for the thirty odd minutes ride back home. At one point though, he started talking about girls.

``So, you're not married right?''

``Nah... not married.''

``Then got girlfriend already?''

``Nope.''

``Wah! Singapore has so many more girls than guys, and you cannot find a girlfriend, a bit malu right?''

``Nah... it's their loss if they can't see me for who I am.''

``Wah lau, your kind really extinct man. You're what, thirty plus years old?''

``Huh? No way... I'm not even twenty-six yet!''

``Orh, no wonder. Your parents haven't nagged at you?''

``These kinds of things, they should know better. What's yours will be yours, what's not yours will never be yours even if you try to force the issue.''

``Seriously, your kind extinct liao...''

And that was the more interesting excerpts from the ride. I know that I mentioned something about cab driver conversations before, but I've not really caught up on that for quite a while as seen by the dates, and so here it is: a more interesting conversation.

Maybe that's why sometimes I'd rather take the cab than take the public transport...

Tuesday, September 28, 2010

Love Takes Time

Sometime I chanced upon:
Something a little different, but still from the wistful singer domain.

*sigh*

Friday, September 24, 2010

Run 10km After 30+ Weeks

Strange to be mumbling here once more I suppose, considering that I don't really have much to say in terms of what is going on in life now. Things are moving at a rather quiet but fast pace, and at times I do feel mildly overwhelmed. As usual, most of life revolves around this little thing called work, and thus fall into the ``I should probably not talk about them too much'' territory. On to other topics then.

What's new? So I have an idea. I wanted to train myself progressively so that I can consistently run 10km. And the time duration I set myself is about 30 weeks. That's right, I'm attempting to run 10km consistently within a time period that is slightly longer than half a year. I'm not sure if I can do it, for a variety of reasons, the foremost of which is that I am not exactly the fittest person to begin with, having sat out of physical education and physical training for the last 16+ years. But I have a simple programme, involving interval training and gradual distance increments scaled linealry (less aggressive) that will hopefully allow me to achieve my goal.

Of course the intensity cannot be too high. Recall that I'm still doing my usual twice a week sessions of Aikido. If I were to go on a more aggressive schedule, I'm sure that my muscles wouldn't be too pleased with that.

The goal is just to run 10km consistently---it is not to achieve a certain speed constraint that I would want for the run. I know that my mean running speed is notoriously bad (roughly 8.2km/h, which is about 2km/h slower than the usual speed that people use).

Hopefully I will be successful with this programme. Till next time...

Saturday, September 18, 2010

Friday Night Musings?

The local time is Friday late night/Saturday early morning. The only person awake in the household is me alone.

Obviously it is a time for yet another rant about the world. And boy do I have a lot to rant about this time.

So in the last couple of weeks I probably met more people that I have met in the last couple of months, and read more books for recreational reading than in the last couple of months also. Actually saying ``books'' is kind of a misnomer, since I only read one book sporadically over the last couple of weeks. It was, strangely enough, a concise description of philosophy through the use of jokes.

Plato and a Platypus Walk into a Bar is a nice romp through the immensely complicated world of philosophy, one that I find myself returning to on vacation time and time again. Unlike most philosophy books, whose authors always take themselves too seriously, Plato and a Platypus Walk into a Bar stays on the thin line between comedy and seriousness, using humour as a means of driving home a key understanding of the particular ideals that are associated with a particular branch of philosophy. It's an awesome book for a light read for those of us who can't separate our Heidegger and our Nietzsche, or get wholly existential about the lack thereof knowledge of the oft [mis-]quoted philosophers. I would love to take credit for discovering this book, but the truth is Joanne was the one who recommended it to me. A good read for those who want to have a sufficiently interesting yet pithy survey of philosophical thoughts up to the end of the twentieth century.

Urgh, I would write more, but I think I'm really drained for the day. So until next time.

Thursday, September 09, 2010

Late Night Keyboard Mashing

I suppose it is a strange feeling when I start to review the visitor logs for the websites that are under my control. Most of the visitors here are from folks who were looking for lyrics of some sort here and there, while of course there are the loyal few who keep following the blogs to discover my hijinks in this life time.

And then there are the visitors from some weird SEO link farm.

Compared to nearly four years ago, this is a drastic drop in the level of interest in people in looking at the things that I am willing to share. I'm not complaining much, and in some sense, it could be a blessing in disguise given my overall direction towards an isolationist/misanthropic policy.

It is only during the few moments of weakness (like when I'm tired or for some reason unable to sustain the necessary neurotransmitter cocktail that promotes happiness) that I am suddenly reminded of my mortality and relative unimportance in the greater scheme of things, up to and including the operation of the world.

To the loyal few who keep coming back to check on what's going on in my fast-becoming uneventful life, I thank you and hopefully there will be a day that I can meet you in real life once more, if we have been separated for some period of time.

------

I began this blog a few years back as a means of letting out steam in the ways that poems cannot, and it has seen me survive what is possibly the five most confusing years of my life thus far. I suppose that it is still fulfilling its purpose even today, and for that I am really glad this was one of the bandwagons that I decided to hop on nearly half a decade ago.

This blog has seen me through my epic failures in life, some of my triumphs and successes, and importantly through the moments in life when I had serious doubts on many things.

For many people, they seek solace and wisdom through their religion, but for me, I find it most cathartic to just talk about it, either on paper on in a blog like this. It is not so much that I need advice---often that is not the intent when I hastily put together a blog post such as this one. Somehow, having the words appearing in clear on the screen has a certain formal feel to it, allowing an almost retrospective style of thinking through things as I re-read and review what I just wrote to have a sense of what I was going to say.

No, I'm not implying I'm wise. I'm just extolling a little on the virtues of keeping a blog like this one.

In other news, I was recently introduced to Girl Genius. I think it is an awesome comic, because of the premise that the story is set in, as well as the rather cool art work and storyline. As you would have realised from the long list of web comics on the right panel of this blog's main page, I am an avid follower of web comics. Web comics have a certain calming effect on me---the surrealism they exude sometimes are a constant reminder that life itself is not always that serious, and that we should all learn how to laugh about something, anything. Maybe this is a release of the repression that I had to go through when I was younger, raised through a rather strict discipline. But of course, that is merely an academic exercise that is not worth expositing upon.

On yet another rather tangential topic, my social circle is fast shrinking like the aftermath of an aged star collapsing into a black hole. Sure, the sphere itself is shrinking, but the density (and thus intensity) of those who remain are increasing a little so I think there's nothing terribly wrong with things.

But then again, it's not necessary to be popular with everyone, right?

Thursday, September 02, 2010

Closure Snafu In Python

Python does not support closures. To use the value of a variable within a lambda expression, rebind the value to a locally defined variable. For instance
accept_set = set([1,2,3])
f = (lambda x, s=accept_set: x in s)
accept_set = set([4,5,6])
print filter(f,range(1,7))
will work as expected from a functional language (i.e. output [1, 2, 3]). But do it without that rebinding
accept_set = set([1,2,3])
f = (lambda x: x in accept_set)
accept_set = set([4,5,6])
print filter(f,range(1,7))
will yield [4, 5, 6] instead.

This is due to Python using pass by reference, and looking up values at run-time. Also, the lack of closures in general.