Skip to content

Instantly share code, notes, and snippets.

View amosr's full-sized avatar

Amos Robinson amosr

View GitHub Profile
@amosr
amosr / sapling_icicle
Last active October 12, 2015 02:03
sapling icicle
When dealing large data sets that do not fit in memory, it is crucial to limit the number
of accesses and iterations over the data set.
However, in a high level language it may not be immediately obvious how many iterations a
particular program will require.
The number of iterations becomes even less obvious in the presence of heuristic and
statistics-based optimisations, as used by traditional databases: a small tweak to the query
or even modifying the number of rows in a table can cause drastic changes to the query plan.
With the advent of "big data", and as data sets continue to grow, a high level language with
predictable runtime characteristics becomes more necessary.
@amosr
amosr / List.hs
Last active August 29, 2015 14:16
ddc php backend
module List
-- (actually List.ds but changed extension for syntax highlighting)
import foreign c value
q_string_concat : String -> String -> String
where
-- | A `Maybe` may contain a value, or not.
data Maybe (a : Data) where
Nothing : Maybe a
Just : a -> Maybe a
@amosr
amosr / Complex.swift
Created July 20, 2014 08:53
I'm trying to write a Complex type that works for any floaty thing, but can't really get it
import Foundation;
protocol Num {
typealias T;
class func plus(T, T) -> T;
class func mul(T, T) -> T;
class func negate(T) -> T;
class func sub(T, T) -> T;
}
module Main where
import qualified Data.Vector.Unboxed as U
import Data.List
import System.Random
import System.CPUTime
import Text.Printf
import Control.Exception
main :: IO ()
@amosr
amosr / linpack.c
Created November 25, 2012 22:56
#include inside a function definition?!
// from linpack benchmark. source: http://www.netlib.org/benchmark/linpackc
/*----------------------*/
REAL second()
{
#include <sys/time.h>
#include <sys/resource.h>
struct rusage ru;