Skip to content

Instantly share code, notes, and snippets.

@fimad
fimad / Label.hs
Last active December 26, 2015 20:38
I needed some way of working with arbitrarily deep stacks of arbitrary types for my current project. This is what I came up with. I thought it was pretty neat so I figured I'd share it.
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE TypeOperators #-}
-- An example of how to have an arbitrary stack of types, while still allowing
-- for easy querying and modifying the value at arbitrary depths of the stack.
--
-- While having multiple of the same type in the stack still type checks, the
@numberten
numberten / gist.pl
Created October 17, 2013 06:16
A compact perl script for gisting files from the command line.
#!/usr/bin/perl
use Getopt::Long;
#Parse flags using Getopt::Long.
my $desc = '';
my $public = 0;
my $user = '';
my $verbose = 0;
GetOptions ('desc:s' => \$desc,
'public' => \$public,
@lspector
lspector / evolvefn.clj
Created October 19, 2011 02:14
Clojure code for a simple genetic programming system, for demonstration purposes.
;; Lee Spector (lspector@hampshire.edu) 20111018 - 20111113
;; 20111113 update: handles functions of different arities
(ns evolvefn
(:require [clojure.zip :as zip]))
;; This code defines and runs a genetic programming system on the problem
;; of finding a function that fits a particular set of [x y] pairs.