Skip to content

Instantly share code, notes, and snippets.

@mgmeier
mgmeier / RingBuffer.hs
Created April 28, 2016 15:09
Ring buffer in Haskell
{-# LANGUAGE BangPatterns #-}
{-
Scenario / preconditions for the usefulness of this ring buffer:
- mutable data structure
- elements of the same size (here: ByteString, extending to values of class Storable should be trivial)
- each element is denoted by a continuous Int id
- main benefit, esp. for a large number of elements:
@mgmeier
mgmeier / GCHQ.hs
Created December 22, 2015 01:01 — forked from ndmitchell/GCHQ.hs
GCHQ 2015 Puzzle in Haskell
module Main(main) where
import Data.Maybe
import Data.List
-- Data table copied from https://matthewearl.github.io/2015/12/10/gchq-xmas-card/
width = 25
height = 25
rows = [