Wednesday, June 15, 2011

Maximum Segment Sum

This is something I always forget. During the summer, I should be learning and practicing how to deduce this linear-time algorithm in a formal way.

The programming languages course has ended today. I've learned something, but didn't practice enough. Those tools for reasoning imperative programs look well in some trivial examples, but I wonder how they can be useful in some larger ones. What I want to know the most is whether these methods can help me figure out an efficient algorithm for certain program. Anyway, I feel more comfortable in programming languages class than algorithms class. The former class is of course a lot easier, but the stuff in it really helps me to understand something, not just memorizing some details in an hard-to-reason-with imperative algorithm.

Computer programming, to me, is not a tool for shipping some valuable things to customers. Developing software is not what I'd be doing well. Programming is rather a thinking aid to me. The better the language interact with your thoughts, the better picture you can get. Monads, for example, exist (in programming) not for some abstract beauty, but really for capturing and shaping some realistic things and processes. After taking so many engineering classes, no single one other than programming languages class really shed some light on the context of discovery. All we see are just results. They are great, significant and beautiful. So what? How can we discover or create something like them, not something that is lame and trivial?

Maybe it's too hard to answer. Too philosophical. Also, asking questions like these just made myself look like a lazy and careless student. Well, I surely won't stop questioning, but I'll make a promise. I promise that I will try harder, harder and harder.

Saturday, May 28, 2011

Some Emacs Stuff



Tuesday, April 26, 2011

Strict function

Operationally, a strict function is one which always evaluates its argument, a non-strict function is one which may not evaluate some of its arguments. Functions having more than one parameter may be strict or non-strict in each parameter independently, as well as jointly strict in several parameters simultaneously.

"f x = f 42" seems to be strict!



Friday, August 20, 2010


在簡單的Perl Script中,常常會在程式碼的結尾加上一列__DATA__,然後在底下放入程式所需的資料。

use 5.010;

while (my $name = <data>) {
chomp $name;
say "Hello, $name!";



my $pos = tell DATA;


seek DATA, $pos, 0;


Tuesday, August 3, 2010


Every basic thing you should know, every kind of skills with which you should be equipped...

Young kid, they are all in books.

Go ahead. Read 'em all.