Skip to content

Instantly share code, notes, and snippets.

View keleshev's full-sized avatar
🐪

Vladimir Keleshev keleshev

🐪
View GitHub Profile
.PHONY: always_run
%.exe: %.s always_run
@arm-linux-gnueabihf-gcc -static -o $@ $<
@-qemu-arm-static $@; echo $$?
@rm -f $@
@keleshev
keleshev / ctrl.reg
Created October 22, 2019 07:16
Windows Registry script for mapping Caps Lock to Ctrl
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
let rec compare_lengths l1 l2 =
match l1, l2 with
| [], [] -> 0
| [], _ -> -1
| _, [] -> 1
| _ :: l1, _ :: l2 -> compare_lengths l1 l2
let rec compare_length_with l n =
match l with

Comparision of JaneStreet Base and OCaml Stdlib

How to use Base

Either use Base selectively:

# #show List.hd;;
module Environment = struct
type t = (string * int) list
let set id number env = (id, number) :: env
let rec get id = function
| [] -> 0
| (key, value) :: tail ->
open Printf
module Token = struct
type t =
| Number of int
| Addition
| Exponent
| Left_paren
| Right_paren
end
let (=>) left right = print_char (if left = right then '.' else 'F')
module Env = struct
include Set.Make (String)
let to_list t = fold List.cons t []
end
let rec map f = function
| [] -> []
| x :: xs -> f x :: map f xs
let hd list = List.nth_opt list 0
let (>>) f g x = g (f x)
let unoption = function
| None -> assert false
| Some a -> a
module Zipper = struct
open Printf
module type GENERIC = sig
type t
val constructor : string -> int -> t list -> t
val string : string -> t
val int : int -> t
end