Wednesday, September 30, 2009

Hope Project at Kenai

Today I started an attempt to write an implementation of Python in Haskell. I have no idea whether I would really succeed in this. But I really want to give it a good try.
The site is hosted at http://kenai.com/projects/hope. I will continue to blog about this from this blog.

HOPE stands for Haskell Oriented Python Environment. At the moment, its just a dream for me and a very very big dream at that. But I hope that I will be able to bring out HOPE sometime !

Wednesday, August 19, 2009

Quicksort in Haskell

Here is my attempt at quicksort in Haskell


quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) = smaller ++ [x] ++ bigger
where smaller = quicksort [y| y <- xs , y < x]
bigger = quicksort [y | y <- xs, y >= x]




So how does this work?


  • [a] ->[a] means that quicksort takes a list as input and returns a list as output

  • (Ord a) means that a belongs to a type class Ord (i.e. a is an ordered type)

  • The first expression means that quicksort returns an empty list for an input empty list

  • The second expression works as follows. The input list is broken into its head and tail (x, xs). We use x as the pivot element. all elements smaller than x in xs are identified and sorted using quicksort itself (recursively). All elements greater than or equal to x are sorted by quicksort itself (recursively). The final result is smaller + [x] + bigger.



So here are some examples:


*Main> quicksort [2, 1, 3]
[1,2,3]
*Main> quicksort "i don't believe you"
" 'bdeeeiilnootuvy"
*Main> quicksort "i love you"
" eiloouvy"
*Main> quicksort [50, 40, 30 , 10, 20, 30, 40, 50, 20]
[10,20,20,30,30,40,40,50,50]
*Main>

Saturday, February 21, 2009

testing code prettifier

Just learnt about how to prettify code inside Blogger.
So trying it out now.


print "Hello World"
for i in range(10):
print i,
print


Well this works nicely.

For more information about how to set it up, please follow it at:

http://lukabloga.blogspot.com/2008/10/to-test-new-highlighting.html

Tuesday, January 6, 2009

user interfaces and criticism

Be warned, this is not serious stuff !!

I happen to do user interface development most of the time. It so happens that I am never able to do something which satisfies everybody. At best I am able to do an OK job. I did get to learn some interesting things over the years.
No matter how much effort one puts in user interface development, its never enough.
Its much much easier to find out issues in user interfaces than to implement solutions which take care of them properly. So just relax.
Its much more comfortable to be in the role of a critic than in the role of implementer. So try hard to get into such a role.
If you don't like the criticism you get, just sit back and relax. Don't reply back. Just ignore it and chill.
You will not like the user interface you have done if you look back at it after a few weeks or few months time. Don't try to improve it!! Its a never ending vicious circle.

Sunday, December 7, 2008

Mobicules

My long-time friends Niraj and Munish have started up a new company Mobicules. The company works in the areas of Web 2.0, social networking applications and related areas. They have been in operation for about a year now and have been doing well.
Both of them worked for Mentor (EDA) for about 5 years.
The company website is http://www.mobicules.com/.