Skip to content

Instantly share code, notes, and snippets.

View egisatoshi's full-sized avatar

Satoshi Egi egisatoshi

View GitHub Profile
;; map function
(define $map : [$A $B] ([(A -> B) {A}] -> {B})
(lambda [$fn $xs]
(match xs (list something)
{[<nil> {}]
[<cons $x $rs> {(fn x) @(map fn rs)}]})))
;; Ord type class
(type $Ordering {<Less> <Equal> <Greater>})
@necrobious
necrobious / gist:14d78ee9b4caff766152
Created July 12, 2014 18:56
Ubuntu 14.04 + GHC 7.8.3 + cabal-install 1.20.0.3
# build with
# docker build -t 'necrobious/haskell-ghc-7.8-64' .
FROM ubuntu:14.04
MAINTAINER necrobious@gmail.com
ENV DEBIAN_FRONTEND noninteractive
####### Install Dependencies ###################################################
RUN apt-get -y update
@foota
foota / count_lattice_path_dfs.cpp
Created September 14, 2012 11:25
Count paths from (0, 0) to (N, N) in the NxN lattice graph using DFS.
// Count paths from (0, 0) to (N, N) in the NxN lattice graph using DFS.
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
static unsigned long long cnt = 0;