Skip to content

Instantly share code, notes, and snippets.

View John-Colvin's full-sized avatar

John Colvin John-Colvin

  • Wiltshire, UK
  • 00:44 (UTC +01:00)
View GitHub Profile

A draft example of kahan sum as an input/forward range (I'm using double just to make it a simple example):

struct KahanSum(R)
{
    R r;
    double sum = 0.0;
    double c = 0.0;
    this(R r)
    {
        this.r = r;
2015-08-13 17:13:41 +0100
python3
setup.py
build
--fcompiler=gnu95
lapack_opt_info:
openblas_lapack_info:
C compiler: cc
@John-Colvin
John-Colvin / TransformMembers.d
Last active August 29, 2015 14:24
Messing with types
import std.typetuple;
import std.typecons;
import std.traits;
struct Pack(TL...)
{
alias expand = TL;
enum length = TL.length;
@disable this();
}
@John-Colvin
John-Colvin / TypeTupleOf.d
Last active August 29, 2015 14:18
TypeTupleOf
import std.range : isInputRange;
import std.array : front, empty, popFront;
template TypeTupleOf(TL...)
if (TL.length == 1 && isInputRange!(typeof(TL[0])))
{
import std.typetuple : TT = TypeTuple;
enum r = TL[0];
static if (r.empty)
alias TypeTupleOf = TT!();
/**
* Explaination comments taken from:
* http://wiki.openstreetmap.org/wiki/PBF_Format#Design
*
* This gives a very basic parsing of osm.pbf files. The purpose was several
* fold.
*
* - Read PBF files
* - Learn the file layout
* - Verify the bytes match