This file contains hidden or 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
| import math | |
| import numpy as np | |
| import random | |
| import matplotlib.pyplot as plt | |
| medium_size = 1024 | |
| x = np.linspace(-1., 1., medium_size) | |
| y = np.linspace(-1., 1., medium_size) | |
| x, y = np.meshgrid(x, y, indexing='ij') |
This file contains hidden or 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
| module Trie = struct | |
| type t = { mutable count : int; children : t option Array.t } | |
| let[@inline] empty () = { count = 0; children = Array.make 128 None } | |
| let add buf pos len t = | |
| let rec loop idx t = | |
| if idx > pos + len - 1 then t.count <- t.count + 1 | |
| else | |
| let c = Char.lowercase_ascii (Bytes.get buf idx) in |
This file contains hidden or 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
| #!/usr/bin/env sh | |
| # A .merlin must be present nearby the file. | |
| # With dune it can be generated by calling `dune build @check`. | |
| FILE="$1" | |
| ocamlmerlin single dump -what ppxed-source -filename "$FILE" < "$FILE" | jq -r '.value' | ocamlformat --name="$FILE" - |
This file contains hidden or 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
| open Higher | |
| (* | |
| See `Free Applicative Functors' http://arxiv.org/abs/1403.0749 | |
| *) | |
| type (_, _) t = | |
| | Pure : 'a -> ('a, 'f) t | |
| | Apply : ('a -> 'b, 'f) t * ('a, 'f) app -> ('b, 'f) t | |
| let pure v = Pure v |
This file contains hidden or 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
| (* See also: http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec238 *) | |
| type _ typ = | |
| | Unit : unit typ | |
| | Int : int typ | |
| | Float : float typ | |
| | String : string typ | |
| | Pair : ('a typ * 'b typ) -> ('a * 'b) typ | |
| | List : 'a typ -> 'a list typ |
This file contains hidden or 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
| (* | |
| Requirement: higher, ppx_deriving.show | |
| *) | |
| (* | |
| Lightweight higher-kinded polymorphism | |
| https://ocamllabs.github.io/higher/lightweight-higher-kinded-polymorphism.pdf | |
| *) | |
| open Higher |
This file contains hidden or 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
| (*--------------------------------------------------------------------------- | |
| Copyright (c) 2015 Daniel C. Bünzli. All rights reserved. | |
| Distributed under the BSD3 license, see license at the end of the file. | |
| %%NAME%% release %%VERSION%% | |
| ---------------------------------------------------------------------------*) | |
| (* Simple generators according to: | |
| Kiselyov, Peyton-Jones, Sabry | |
| Lazy v. Yield: Incremental, Linear Pretty-printing |
This file contains hidden or 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
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # All Vagrant configuration is done below. The "2" in Vagrant.configure | |
| # configures the configuration version (we support older styles for | |
| # backwards compatibility). Please don't change it unless you know what | |
| # you're doing. | |
| Vagrant.configure("2") do |config| | |
| config.vm.box = "boxcutter/ubuntu1604-desktop" |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # This is how I used it: | |
| # $ cat ~/.bash_history | bash-history-to-zsh-history >> ~/.zsh_history | |
| import sys | |
| def main(): |
NewerOlder