XMonad has been my go-to window manager for many years. In its most popular tiling layout, XMoand splits the window into 2 panes. Recently, I got a 21:9 ultrawide monitor. It’s when traditional two-pane looks unsatisfactory.

Blackjack is one of the most played games in casinos and in fact, one of the most fair games. Theoretically, if you follow the basic strategy, the house’s advantage is about 0.5%. Unfortunately, the basic strategy seems clumsy for a first-time visitor like me. So I decided to opt for the simple strategy, which would give the house a bit more advantage but it should not be obvious to notice.

However, not all casinos implement the assumed blackjack rule in basic strategy :joy:. In fact, most of them don’t, which give them a bit more advantage. The rules for the casinos in Vegas can be found here.

I’m playing with Leetcode 65 - Valid Number. I prefer some solution that is more generic. Hence, I made a parser with Python. It’s based on the idea of monadic parsing, common in functional languages. The source code can be found in this Gist.

Hakyll uses Pandoc to process markdown and code snippets. It’s very easy to integrate Kate to Hakyll for code highlighting. But I choose to switch to Pygments due to its support for many programming languages.

This post is about writing a parser in Standard ML. I try to fit the code in the idiom of Haskell. It may not pragmatic SML code.

ROS is a set of software libraries and tools that help build robot applications. This semester, my CSE 568 project is all about ROS. As a functional programming enthusiast, I would like to step away from the Python and C++ world ROS lies in.

roshask is a Haskell binding to ROS. It provides the facility to create ROS nodes, communicate with ROS and generate Haskell data types from ROS message definitions. The generation of Haskell datatype is very appealing as it provides type-level guarantee of the format of messages – I just can’t express more about my frustrations with programming ROS in Python and having to diagnose everything in runtime. So far so good, only when it comes to working with TF.

I’m doing a project to modify MLton’s garbage collector. But working with MLton’s source code is a bit painful. The only way to do it was to use the good old “grep” command. Since I’m not quite familiar with Standard ML, I want more hints / error checks while I’m editing the code.

Enlive is a Clojure web templating library that combines vanilla HTML templates with backend logic. It’s a perfect separation of logic and frontend development in that it does not require frontend developers to know anything about the backend platform – only pure knowledge of HTML (maybe JS, CSS) is required.

I’m reading Pearls of Functional Algorithm Design, which is just a wonderful book on algorithms and functional programming. I’m also playing around with Category Theory and I enjoy the feeling of abstraction. I try to apply some of the ideas to some basic algorithm problems, and it seems to work. Here is a very simple example.

What to Expect from this Post

Currently the MLton runtime compiles against Sparc RTEMS (Leon 3 BSP). The MLton is capable of recognizing RTEMS and Sparc in -target flag. But the compiled executable does not work.

I was always afraid of Haskell Monads. But… I like Haskell, which means, Monads are inevitable. Well, so let me have a taste.

Let’s say, the code is:

((++) =<<) (const "hello") "world"

What’s that? Let’s get the clue from type.

Recently I was reading a book on programming languages design and came across something interesting related to Y combinator.

The Question: how to write recursion in lambda function without side effects and built-in recursion support?

First, let’s talk about Russell Paradox: Assume P is the set of all the set that does not contain itself. Does P belongs to P?

Under classical set theory, this is a paradox. The type system for dynamic language more or less resemble such set theory. Let’s say, F is a characteristic function of a set. F(x) = true if x is in the set and F(x) = false otherwise. Under such representation, {1, 2, 3} can be represented as F(x) = (x==1 OR x==2 OR x==3).

I tried to play Flappy Bird, but it was hard. I tried multiple times, only got best score of 7.

Flappy Bird

Flappy Bird looks nothing innovative as compared to other ones like JetPack. But why is it so hard?