Want to get updates? You can add the feed link to your favourite feed reader. For email updates, you could subscribe via feedrabbit.

#haskell

Haskell in C++: The IO Monad

June 23, 2021

In a previous post, I described how to implement Functors in C++. Now I will try to represent the IO monad, with a few toy examples.

Read more...

[Haskell for CP] Solving an interactive problem using laziness

Haskell is an interesting and beautiful language for many reasons. One is laziness, which lets us write very elegant computation recipes.

I will attempt to solve an interactive CP problem from a recent codeforces contest - Guess the K-th Zero.

Read more...

Haskell in C++: Implementing pure functional constructs in c++ using templates

May 21, 2021

When I first learnt Haskell a while back, I found it difficult to adjust my thinking to the pure-functional style. Especially because I have been coding in imperative languages for more than 7 years before that. It took me a while to fully grasp and appreciate the elegance of these constructs in Haskell, like functors and monads. At some point, I attempted to implement the same constructs in C++, to help my understanding, and get a feel of the expressive power Haskell has.

Read more...

Advent Of Code 2020 - in Haskell

May 17, 2021

A few months ago, I was introduced to the Advent Of Code contest series. The 2020 round has just begun, and looking at the problems from previous years, I felt it would be fun and challenging to program them in Haskell. And so I got to work and got 40 out of 50 stars at the end. This was incredibly fun, and surprisingly difficult at certain stages, and I want to share my thoughts with others.
I have put up my solutions on GitHub.

Read more...

[Haskell for CP] Exploiting laziness for memoized DPs

In this blog I attempt to solve the Partition Problem using Haskell. The key is to utilize laziness to cleanly express the standard dynamic-programming solution for the problem.

Read more...

[Haskell for CP] Some Basic Problems

This week I will be discussing a couple of basic problems: Repetitions and GCD on Blackboard

Read more...

[Haskell for CP] Knapsack DP reinvented

Here is the problem Money Sums that I shared in my last blog

You have $n$ coins, with values $x_1, x_2 \ldots x_n$. You have to find all possible totals you can form with them.

Read more...
Blogs Home | Full Blogs List | All Tags