View qsort.sml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datatype 'a tree | |
= Leaf | |
| Node of 'a tree * 'a * 'a tree | |
fun build (op <) = | |
let | |
fun loop nil = Leaf | |
| loop (x :: xs) = | |
let | |
val (xs, ys) = List.partition (fn y => y < x) xs |
View euler165.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <iostream> | |
#include <set> | |
#include <vector> | |
#include <boost/rational.hpp> | |
using ext_coord = std::int64_t; | |
using int_coord = boost::rational<ext_coord>; |
View GADT.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
import Control.Arrow | |
data Sized a where | |
Unit :: Sized () | |
Int :: Sized Int | |
Char :: Sized Char | |
Sum :: Sized a -> Sized b -> Sized (Either a b) | |
Prod :: Sized a -> Sized b -> Sized (a, b) |
View HList.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import List. | |
Section HList. | |
Variable A : Type. | |
Variable B : A -> Type. | |
Inductive hlist : list A -> Type := | |
| HNil : hlist nil | |
| HCons : forall x xs, B x -> hlist xs -> hlist (x :: xs). | |
View DELETE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In all cases, the subtree marked with an asterisk is one level shallower than its siblings. | |
CASE 1: | |
--------- --------- | |
| 1 | 4 | | 1 | 3 | | |
--------- --------- | |
/ | \ / | \ | |
a | e* a | \ | |
--------- ===> ----- ----- |
View arena.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
#include "arena.h" | |
struct block { | |
union { | |
struct block *prev; | |
max_align_t nope; | |
}; |
View ghci
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lolcathost% ghci | |
GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help | |
> type F a = (a, a) | |
> type G a = F (F a) | |
> type H a = G (G a) | |
> type I a = H (H a) | |
> type J a = I (I a) | |
> type K a = J (J a) | |
> let f :: a -> F a ; f x = (x, x) | |
> let g :: a -> G a ; g x = f (f x) |
View Hamming.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
merge xxs@(x:xs) yys@(y:ys) = | |
case compare x y of | |
LT -> x : merge xs yys | |
EQ -> x : merge xs ys | |
GT -> y : merge xxs ys | |
xs = map (*2) hamming | |
ys = map (*3) hamming | |
zs = map (*5) hamming |
View existing.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table male | |
( male_id int not null | |
, name varchar(100) not null | |
, primary key (male_id) ); | |
create table female | |
( female_id int not null | |
, name varchar(100) not null | |
, primary key (female_id) ); |
View santa-nerds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Quashie> I'm heading to new york city and questioning my future | |
<Quashie> for the holidays | |
<nso95_> I'm questioning your future too [00:51] | |
<someoneigna> Well my future is going to be dark >_< | |
*** DarkCthulhu (~DarkCthul@84.64.65.234) has quit: Quit: Bye | |
*** raunicolae (~raunicola@95.76.171.140) has quit: Client Quit [00:52] | |
<reaga> i had a really good idea | |
*** DarkCthulhu (~anirudh@101.63.161.88) has joined channel ##programming | |
<Sprocklem> what now? | |
<reaga> what if.. what if a web page played the sound "isnt it annoying when |
OlderNewer