Archive for the 'functional' Category

libgmp.so missing in Ubuntu 10.04?

When programming Haskell, I usually hack in a GHCi interactive session.  So I was surprise when I tried to make a test executable the other day:

ralph@vegeta:~/src/haskell$ ghc --make Hello
[1 of 1] Compiling Main             ( Hello.hs, Hello.o )
Linking Hello ...
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status

libgmp is a library for arbitrary precision arithmetic, which is something Haskell does well. So, I was surprise that I was getting this message. The obvious solution is install the Ubuntu package for libgmp:

ralph@vegeta:~/src/haskell$ sudo apt-get install libgmp3c2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgmp3c2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 44 not upgraded.

Well that was strange!  So, I searched for libgmp on my system:

ralph@vegeta:~/src/haskell$ find /usr/lib/ -name libgmp*
/usr/lib/ssl/engines/libgmp.so
/usr/lib/libgmp.so.3.5.2
/usr/lib/libgmp.so.3

There is no libgmp.so symlink, so I just created one:

ralph@vegeta:~/src/haskell$ cd /usr/lib 
ralph@vegeta:/usr/lib$ sudo ln -s libgmp.so.3 libgmp.so

Now everything compiles and links:

ralph@vegeta:~/src/haskell$ ghc --make Hello
[1 of 1] Compiling Main             ( Hello.hs, Hello.o )
Linking Hello ...
Advertisements

Groovy Baby, Yeah!

groovybabyWorking in mostly M$ shops in the past 10 years or so, coupled with my home projects in the functional languages, I don’t get to do much with Java or the JVM anymore.  But today, it was treated to my first experience in programming in Groovy.  The tool that I use to test SOAP web services, SoapUI, is built upon Java and uses the Groovy as embedded scripting language to manipulate the testing environment.

I must say that it is a pretty neat.  Just using it as a scripting language seem to be natural, almost like Python or Ruby. Even though I did not use any advanced features such as closures, builders, or regular expressions, I hope that I can give it a try some time.

Reading Programming Erlang

A few weeks ago, I received my copy of Joe Armstrong’s Programming Erlang: Software for a Concurrent World.  I was quite impressed.  It was a great introduction on the Erlang programming language and more importantly, concurrent programming. After reading the book, I am not sure if I fully understand it’s true power.  

What do I mean? The idea of having a language that is built for fault-tolerant, distributed, concurrent, mostly real-time applications may come as a pipe dream to some. To me, Erlang is the real deal. It’s simplified view of concurrency makes it easy to create high performance systems.  It’s share-nothing attitude toward memory and communication allows for high process scalability.  The simple fact that Erlang is a functional language allows these two concepts to exist.

There is just no equal in mainstream languages. Some may think that it was designed at some University and it’s nothing but a toy language.  The truth is that Erlang was created by a real company, by career engineers, to solve real world concurrent problems, and used in real products. So, one cannot really use that argument anymore.

 As recommended by the author, I have to read the book again and again.  I hope that I am able to read it again before I receive Real World Haskell in a few weeks.