Tuesday, May 26, 2009

Forth resources



"The Forth story has the making of a morality play: Persistant young programmer struggles against indifference to discover Truth and save his suffering comrades. It gets better: ...

I know Forth is the best language so far. I'm pleased at its success, especially in the ultra-conservative arena of Artificial Intelligence. I'm disturbed that people who should, don't appreciate how it embodies their own description of the ideal programming language.

But I'm still exploring without license. Forth has led to an architecture that promises a wonderful integration of software and silicon. And another new programming environment."

-Chuck Moore, developer of Forth.

I like the idea of using stacks to keep track of bits. To give an example, take the gmail inbox. There is now a feature called "archive". We could select mails and archive them - the read mails are popped out of the inbox stack and dropped in the archive stack, away from view. This way, the inbox becomes manageable. I leave only mails that need to be replied to in the inbox, and as soon as possible, send a reply, and archive it.

Obviously, we can't be staring at an empty inbox for long. We can now clear gmail from our stack, and proceed to the next task awaiting.

I stack only a dozen items or less in my head, and give priority to one item at a time, and try to clear the stack as quickly and efficiently as possible, paying utmost attention to the task at hand.

Imagine this as a way of life. A philosophy. A program. That's Forth. Its Turing complete and really close to a Turing machine. The stack is the only window to the infinite tape. Every shift/read operation is defined as a word. This way, it provides elegant integration between software and silicon - it could hardly get better than this. It looks like a high level language to humans and a low level one to machines (or vice versa, depending on how you think).

Whatever the future may hold for Forth, its a wonderful way to learn about representing information, programming and compiling for finding solutions to problems using software and hardware. It could run in just 8k of memory. Forth developed from 1950's as a complete operating system and programming language. Its basics could be learnt in a day or two. Going Forth is not exactly easy, but worth the effort!

Resources to get started with Forth:

http://www.colorforth.com/HOPL.html
http://www.forth.com/starting-forth/sf0/sf0.html
http://thinking-forth.sourceforge.net/
http://www.jwdt.com/~paysan/gforth.html
http://www.forth.org/fd/contents.html
http://www.pin1.org/forthlib/
http://www.taygeta.com/fsl/sciforth.html

Thanks to Joseph Koshy for writing about Forth language in a mail.

Friday, May 22, 2009

A poem from Purananuru



யானை புக்க புலம்

காய்நெல் லறுத்துக் களவங் கொளினே
மாநிறை வில்லதும் பன்னாட் காகும்
நூறுசெறு வாயினுந் தமித்துப்புக் குணினே
வாய்புகு வதனினுங் கால்பெரிது கெடுக்கும்
அறிவுடை வேந்த னெறியறிந்து கொளினே
கோடி யாத்து நாடுபெரிது நந்தும்
மெல்லியன் கிழவ னாகி வைகலும்
வரிசை யறியாக் கல்லென் கற்றமொடு
பரிவுதப வெடுக்கும் பிண்ட நச்சின்
யானை புக்க புலம்போலத்
தானு முண்ணா னுலமுங் கெடுமே.

- பிசிராந்தையார்

The field entered by an elephant

"If an elephant take mouthfuls of ripe grain cut for it,
The twentieth part of an acre will yield it food for many days;
But if it enter a hundred fertile fields, with no keeper,
Its foot will trample down much more than its mouth receives.
So if a wise king, who knows the path of right take just his due,
His land will prosper, yielding myriadfold,
But, if the king, not softened by his knowledge, take just what he desires,
Nor heed prescriptions rule, feasting with song and dance,
Amid his court and kindered, and show no love to his subjects;
Like the field that elephant entered,
His kingdom will perish, and he himself will lose his all".

-Translation by Rev. Dr. G.U. Pope

The above verse is an obituary by a friend in the memory of his master, the King. G.U. Pope comments, they were not exactly "words of love." The players there are Ko-Perum-Cholan, Pottiyar and Piciranthaiyar - the noble King and his two intimate friends, who were also poets. All the three, after death were commemorated by stones placed side by side over their urns.

Apart from the discourse on why and how anyone should use valuable resources without waste, the composition also elegantly applies the Tamil fraction 1/20 'ma' [மா] in the 2nd line.

Thursday, May 21, 2009

Erdös number

Could life be expressed as a set of numbers?

The Erdös number is probably part of such an attempt! The Hungarian mathematician Paul Erdös [1913-1996] collaborated with hundreds of mathematicians during his life time - 511 to be precise, including a few Indians as well. They might have collaborated with others, and a network of collaborating mathematicians emerges. Erdös number is in honour of him. He himself is given number 0 and those who directly collaborated with him are assigned number 1. Those who never collaborated with Erdös, but had contributed papers with any of the 511 get number 2, so on and so forth. Just for fun, if you have contributed papers, you may try to trace your trail to Erdös and publish your Erdös number! Though this is a "humorous tribute" to the mathematician, it has a huge potential of bringing mathematics closer to social science improving quality of computations based on society.

A list of mathematicians with Erdös numbers 1, 2 and 3 are listed at:
http://en.wikipedia.org/wiki/List_of_people_by_Erd%C5%91s_number

Like the many have not joined that network, my Erdös # is infinity.

References:
[1] http://en.wikipedia.org/wiki/Paul_Erd%C5%91s
[2] http://en.wikipedia.org/wiki/Erd%C5%91s_number
[3] http://fourmilab.ch/documents/erdos_number/

Sunday, May 10, 2009

Relevance of Harold Laski

Harold Laski once said, "I really don't think there is anything to say about me except that I am honest and anxious to see a decent world before I die." Time magazine wrote an obituary for Laski titled "History's Revenge", saying "[s]ome people maintain that Manchester was the only place where Harold Laski could have been born. Manchester had nursed the industrial revolution and produced the "Manchester school" of laissez-faire liberals e.g., John Bright, Jeremy Bentham, Richard Cobden. State Planner Harold Laski, the argument went, was History's revenge on the city of Manchester." Laski was professor of Political Science at the London School of Economics [LSE] and advocated Socialism. He greatly influenced a number of Indian leaders who studied in Britain, including Dr. B.R. Ambedkar, the architect of India's Constitution. "Political Science" is part of the Law Course at Madras Law College [as it was called then] and "Grammar of Politics" by Laski is prescribed for study. He continues to exert influence and probably has many answers to problems that would come in the future for those prepared to understand his thoughts. The book analyses the judicial process and according to Laski, "[w]hen we know how a nation-State dispenses justice, we know with some exactness the moral character to which it can pretend."

"The Art of the Advocate" by Richard Du Cann presents many tidbits from Laski v The Newark Advertiser Co. Ltd and Parlby.
The brief facts are that, on Saturday, 16th June, 1945, at the height of the General Election, Professor Harold Laski addressed a crowd of over five hundred people, in support of a Labour party candidate at Newark, and as he was about to leave, a journalist from the Newark Advertiser asked him why Laski "openly advocated revolution by violence". The "Newark Advertiser" reported Laski's reply as: "As for violence, he continued, if Labour could not obtain what it needed by general consent, 'We shall have to use violence even if it means revolution'." Laski sued "Newark Advertiser" along with Parly, its Editor and Managing Director, that the report was false and malicious, that, by innuendo, the report meant and was understood to mean that Laski had declared his intention to commit and to conspire with others to commit the crimes of treason, treason-felony, sedition, riot, and breach of the peace and that Laski had been thereby injured in his reputation. The defence claimed the report was fair and that the words did not mean what was alleged in the innuendo. The justification claimed on the basis of pamphlets and books, that Laski had been preaching 'revolution by violence' at Newark as he had throughout his active life. The trial is said to have lasted five days, and the jury decided in forty minutes that the report was fair and accurate. The action was dismissed with costs. They did not go on to decide whether Laski had habitually advocated violence as their decision was just that he used those words at Newark. Time magazine mentions in the above said article that, "Laski had to pay all the court costs of $52,000, including a thumping fee to the paper's lawyer, wealthy Sir Patrick Hastings."

The print media lives by generating heated controversies. Laski fed them with prime fodder.

Harold Laski wrote in 1925, in his "Grammar of Politics", "[e]very legal system involves, in its working, an unprofessional element, of which the jury is the most notable example", and said, "[i]t is, therefore, a matter of importance in any judicial system to confer powers of general jurisdiction only upon persons of trained competence in the law." His own trial two decades later only confirmed his theory.

Qualitative competence in the legal system is something Laski desired deeply. Babbage, Turing, Laski and many others suffered in some way or the other under the system over them. They painstakingly wrote defensively in support of welfare for the majority, but somehow they only got trampled by events in the end.

Time magazine concluded, "Jeffersonian-Marxist Harold Laski, for all his brilliance, had never made it quite clear what he considered a decent world to be." That only shows how widely "Grammar of Politics" was read. History hasn't stopped counting the days past and just started labeling its days as that of the "information era". Laski started his grammar book with the line: "No theory of the state is ever intelligible save in the context of its time." Ever increasing automation and space exploration needs set a new context for state theories. "History's Revenge" would come only when Laski is more widely understood and appreciated. Even if it never does come, it would cause no peril to the reputation of Laski.

References:
[1] "History's Revenge", Time article dated 3rd April, 1950 at http://www.time.com/time/magazine/article/0,9171,934881,00.html
[2] "LSE-India past and present" at http://www.lse.ac.uk/collections/LSEIndia/pastAndPresent.htm
[3] "A Grammar of Politics", Harold J. Laski.
[4] "The Art of the Advocate", Richard Du Cann

Tuesday, May 05, 2009

ㄈபோல் வளை

Avvayar's ancient Attisudi says:

"ஙபோல் வளை"


Edward Jewitt Robinson translated that as, "Consort, like letters [of 'ங' series] in array."

The explanation by Na.Mu. Venkatasamy Nattar is as follows:

ங என்னும் எழுத்தானது தான் பயனுடையதாயிருந்து பயனில்லாத ஙா முதலிய தன் வருக்க எழுத்துகளைத் தழுவிக்கொள்ளுதல் போல, நீ பயனுடையவனாயிருந்து உன் இனத்தார் பயனில்லாதவராயினும், அவரை தழுகிக்கொள்.

ஙா முதலிய பதினொரெழுத்தும் எந்தச் சொல்லிலும் வருவதில்லை. ஙகரத்தில் பொருட்டே அவற்ளையும் சுவடியில் எழுதுகிறார்கள். இனி இதற்கு ஙகர வொற்றானது அகரவுயிர் ஒன்ளையே தழுவுவது போல நீ ஒருவனையே தழுவு என மாதர்க்குக் கூறியதாகவும் பொருள் சொல்லலாம்.


Except ங [ṅa] and ங் [ṅ], none of the others in the series ஙா ஙி ஙீ ஙு ஙூ ஙெ ஙே ஙொ ஙோ ஙௌ are used in any Tamil word. Hence, consort like ங [ṅa].

The aphorism taken more literally translates to "bend like the consonant 'ங'" [ṅa]. This interpretation does not really go well with the rest of the aphorisms in the Attisudi. The Tamil script has undergone major changes every century for various reasons. During the times of Avvayar, 'ங' seems to have been written thus: ㄈ That looks more like a square bracket. The aphorism now lends itself to ethically tenable meanings like: "fortify fences like ㄈ [ṅa]", "encircle and protect like ㄈ [ṅa]".