First Step on Learning Haskell

As part of my practicing in functional programming, working on some Haskell program for several weeks. It’s great experience, but the learning cost is pretty high around I/O and Types. I’m pretty much struggling, but there are many nice resource online, and gradually grasping the underling concept.

Especially, http://learnyouahaskell.com/ is a great resource to learn its concept step by step. With some experience on funcational aspect of Erlang/Elixir/Ruby, gradually getting to understand them, though the Monad or IO Action part is difficult to digest yet. Anyway, its declarative expressions are powerful and concise and impressive.

Then, it starts with fibonacci as always.

The pattern match is pretty nice as always. The lazy evaluation and memoziation would be one Haskell’s key factor, and it works nicely.

(on my MacBook Air)

% /usr/bin/time -p runhaskell fib.hs 40
102334155
real        11.71
user        11.49
sys          0.22

% /usr/bin/time -p runhaskell fib_memoize.hs 40
102334155
real         0.30
user         0.16
sys          0.05

References

Advertisements

Posted on December 30, 2014, in Haskell, Software Design. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: