Skip to content

Instantly share code, notes, and snippets.

@ontologiae
ontologiae / gist:2d04d6ddfaaf0ca19d57
Last active August 29, 2015 14:00
Problem with type interlocking
module type E = sig
type event
end
type ev = Ev;;
module EE : E = struct type event = ev end;;
module type StateType =
type distance = int
type events =
| Explosion_mine_sous_marine of distance
| Detect_bateau of distance list
| Bateau_recoit_torpille
| Bateau_Detect_uBoat of int * int
| Uboat_envoie_torpille
module Types = struct
type (_, _) cons = private TCons
type nil = private TNil
type _ t =
| Nil : nil t
| Cons : int * 'a * 'b t -> ('b, 'a) cons t
end
include Types
@ontologiae
ontologiae / gist:2a27a79fede47649b335
Created September 16, 2014 21:21
OCaml Chuck Norris Patch
From 830a4fba2acc6c1d8641e30033fa9bab8fd7638c Mon Sep 17 00:00:00 2001
From: Mark Shinwell <mshinwell@janestreet.com>
Date: Thu, 11 Sep 2014 11:17:36 +0000
Subject: [PATCH 1/2] minor update of comment in gc.mli
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15212 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
stdlib/gc.mli | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@ontologiae
ontologiae / gist:20b02bae123da47b4d9f
Last active August 29, 2015 14:06
Carte alignement
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple Polylines</title>
<style>
html, body, #map-canvas {
-- Création et ajouts des nombres à tester
drop table nombres;
create table nombres(id serial primary key, nombre double precision);
insert into nombres(nombre) values(3.14159265359),(3.14159265359*10),(3.14159265359*100),(3.14159265359*1000)
,(2.71828182846),(2.71828182846*10),(2.71828182846*100),(2.71828182846*1000)
,(1.61803398875),(1.61803398875*10),(1.61803398875*100),(1.61803398875*1000)
,(1.61803398875*3.14159265359),(1.61803398875*3.14159265359*10),(1.61803398875*3.14159265359*100),(1.61803398875*3.14159265359*1000);
-- Création de la table résultat
create table resultats( id serial primary key, type_resultat character, e double precision, pi double precision, phi double precision, pi_phi double precision, total double precision);
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.factory.GraphDatabaseBuilder;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.graphdb.Result;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.helpers.collection.IteratorUtil;
<artifactItem>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-io</artifactId>
<version>2.3.1</version>
</artifactItem>
<artifactItem>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-consistency-check</artifactId>
<version>2.3.1</version>
</artifactItem>
-- Gizeh, Nazca, Paques
CREATe TABLE lieux(nom text primary key, point geometry(point,4326));
insert into lieux(nom,point) values ('Gizeh',ST_setsrid('POINT(31.133940 29.979437)'::geometry,4326));
insert into lieux(nom,point) values ('Nasca',ST_setsrid('POINT(-75.133333 -14.716667 )'::geometry,4326));
insert into lieux(nom,point) values ('Paques',ST_setsrid('POINT(-109.424205 -27.190547)'::geometry,4326));
insert into lieux(nom,point) values ('Mohen-Jo-Daro',ST_setsrid('POINT(68.137211 27.326851)'::geometry,4326));
insert into lieux(nom,point) values ('Petra',ST_setsrid('POINT(35.44361 30.32917)'::geometry,4326));
insert into lieux(nom,point) values ('UR',ST_setsrid('POINT(46.10551 30.961243)'::geometry,4326));
type opc = M | P ;;
type opnc = D | S;;
type vals = A | B | C;;
open Sequence.Infix;;
let combs k l =
let n = List.length l in