Haskell
Posted on September 28, 2006
I do not understand Haskell,
First: in one place we use [a] to define list of any types, in another we use _ as any type
Second from the Haskell faq:
…
data Color = Red | Green | Blue | Indigo | Violet
…
Here is an example of a type with just one data constructor:data Point a = Pt a a
Because of the single constructor, a type like Point is often called a tuple type, since it is essentially just a cartesian product (in this case binary) of other types. (Tuples are somewhat like records in other languages.) In contrast, multi-constructor types, such as Bool and Color, are called (disjoint) union or sum types.
More importantly, however, Point is an example of a polymorphic type: for any type t, it defines the type of cartesian points that use t as the coordinate type. The Point type can now be seen clearly as a unary type constructor, since from the type t it constructs a new type Point t. (In the same sense, using the list example given earlier, [] is also a type constructor. Given any type t we can “apply” [] to yield a new type [t]. The Haskell syntax allows [] t to be written as [t]. Similarly, -> is a type constructor: given two types t and u, t->u is the type of functions mapping elements of type t to elements of type u.)
Note that the type of the binary data constructor Pt is a -> a -> Point a, and thus the following typings are valid:
Pt 2.0 3.0 :: Point Float
Pt ‘a’ ‘b’ :: Point Char
Pt True False :: Point Bool
So for Colour user data type is on the left but for Point it is on the Right and is called Pt? What the fuck is Pt anyway?
Why cant we simply write Point x = (x,x) or something like that?
Thrid: why I do I have to write code in the text file, load it in the interpreter and run it but I can not enter data directly into interpreter?
Filed Under Uncategorized | 4 Comments
IDE+Colour+VersionControl
Posted on September 28, 2006
Hmm, I think it would have been cool is IDE highlighted recently made changes in the source code. With colour shades that depended on how old the changes are. Therefore, if there are several developers working on the same project, one can see if he is working on the newly updated code, and maybe understand why that code was changed. Moreover, since that is a new code developer has to pay special for bugs.
All that information is already in version control system, so I think that it is possible to write a simple plug-in for IDE.
Filed Under Uncategorized | Leave a Comment
Profs
Posted on September 27, 2006
Some professors are funny: Hai Doan-Nguyen said that we will give a pop quiz sometime next week, but we only have one class a week; I also managed put his brain in infinite loop for 5 minutes with one (stupid) question.
Some are smart: Opatrny opened black.pdf when he needed to write on the blackboard.
Filed Under Uncategorized | 1 Comment
What the fuck is going on? Where does this world i…
Posted on September 25, 2006
What the fuck is going on? Where does this world is going it it is now possble to loose your balls simple by working on loptop on you lap!
My IBM laptop is on all the time, does it meen that it can burn down my house?
If Dell and IBM have this problem, I assume that all other brands are not safe too. Fuck!
Filed Under Uncategorized | Leave a Comment
Unchecked Exceptions in C#
Posted on September 22, 2006
I was playng with C# and I found something I do not understand.
What is the strategy of working with unchecked exceptions in C#? I mean it’s nice that socket timed out, and I now know about potential error. But my method does not indicate in it’s contract that it may throw an exception, so if I will try to use sombody else code, how can I be sure that I won’t get a surprise exception?
So my questions are:
- How can I get a set of exceptions method can throw.
- Can I make Visual Studio show me that I am calling potentially dangerous code?
- Can I automatically surround method call with try/catch construct that catches every specific exception in VC# Express 2005.
- What is the reasoning behind unchecked exceptions if you still have to catch them?
Filed Under Uncategorized | Leave a Comment
COMM229M
Posted on September 20, 2006
Here is a good quote from a book:
Put yourself in the position of a military commander on the verge of leading your troops into a major ground battle. The soldiers in your battalion are pumped up by a potent mix of fear and excitement. Caught up in the emotion, you order your soldiers to move forward into enemy territory. Within half an hour you’re completely surrounded by hundreds of heavily armed enemy soldiers on foot and in tanks. As you hear the unmistakable clicking sound of the safety locks being removed on a terrifying number of rifles aimed at you and your troops, the optimist in you thinks: “Perfect, just perfect. We can attack in any direction!” Then the realist in you kicks in as you begin to realize that imminent defeat, or worse, is at hand. Just before ordering a complete surrender, you wonder what you should you have done to have prevented this dangerous, woeful situation. As you and your soldiers lay down your arms and hope for kindness from the enemy, the answer comes burning through your sweaty skull: “Before moving into enemy territory, I should have conducted a situation analysis.”
On the other hand, who said I would order to surrender? ;-)
Filed Under Uncategorized | 2 Comments
Filler
Posted on September 19, 2006
Developers of Ruby on rails don’t follow the hype and use time tested PHP for their website.
Server: Apache/2.2.2 (FreeBSD) mod_ssl/2.2.2 OpenSSL/0.9.8b DAV/2 PHP/5.1.4 SVN/1.3.2 mod_vd/2.0 mod_fastcgi/2.4.2 proxy_html/2.5
Also in the new is release of the new version of Python. After 20 month of depelopment a new major version has a lot of new features. What’s New in Python 2.5
Filed Under Uncategorized | Leave a Comment
In his own words
Posted on September 15, 2006

And that is exactly what he said. In the next class he was actually making fun of guns and recent shooting. Sigh.
Filed Under Uncategorized | 2 Comments
Байка про греблю
Posted on September 14, 2006
Американцы и японцы решили устроить соревнование по гребле. Обе команды долго и упорно тренировались, чтобы достичь высшей спортивной формы. И вот в один прекрасный день, они решили, что уже готовы. Японцы победили, обогнав американцев на одну милю.
Американская команда была горько разочарована своим проигрышем. Просто пала духом. Корпоративное руководство постановило, что надо найти причину разгромного поражения и потому наняло консалтинговую фирму, чтобы разобраться, в чем проблема и получить совет, что следует предпринять. Консалтинговая компания выяснила, что в японской команде восемь человек гребли, а один был на руле, тогда как в американской был один гребец и восемь рулевых. После года изысканий и миллионов долларов, потраченных на анализ проблемы, консалтинговая фирма пришла к выводу, что в американской команде было слишком много рулевых и слишком мало гребцов.
Итак, по мере того как в следующем году приближался день повторных соревнований, структура руководства американской команды была полностью реорганизована. В новой структуре было четыре менеджера по рулению, три менеджера в области руления и новая система оценки выступления гребца, чтобы обеспечить рабочую инициативу.
На следующий год японцы обогнали американцев на две мили. Униженная американская корпорация уволила гребца за плохое выступление и выдала менеджерам премию за выявление проблемы.
Filed Under Uncategorized | Leave a Comment
Alarm Clock
Posted on September 11, 2006

Thank you Mark McIntyre for the Citrus Alarm Clock, a lovely alarm clock that wakes me up every day. Before that I used Windows Scheduler, and it was pain in the ass to adjust it. But now I can easily set a separate time for every day of the week when it will start playing my favorite radio station; not only that but it also slowly adjusts volume from 0 to 100%, so I don’t have to jump from bed right away.
Filed Under Uncategorized | Leave a Comment