Skip to content

Instantly share code, notes, and snippets.

@joelonsql
joelonsql / gist:e5080a344c37b076f03abefc1778b91c
Created November 2, 2017 16:39
Man or boy test C -> LLVM IR
/*
; ModuleID = 'man_or_boy.c'
source_filename = "man_or_boy.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
*/
typedef struct arg // %struct.arg = type
{ // {
int (*fn)(struct arg*); // {}*,
[
Takes an integer from stdin and emits its factors to stdout
Factor an arbitrarily large positive integer
Copyright (C) 1999 by Brian Raiter
under the GNU General Public License
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-
(* Added by OPAM. *)
let () =
try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
with Not_found -> ()
;;
#use "topfind";;
#thread;;
#require "core.top";;
#require "core.syntax";;
filepath functionname min arguments count
./src/array.mli equal 2017-03-02 18:25:32+01 'a t -> 'a t -> equal:('a -> 'a -> bool) -> bool 2
./src/array.mli equal 2018-08-23 10:56:24+02 ('a -> 'a -> bool) -> 'a t -> 'a t -> bool 2
./src/array.mli filter 2017-03-02 18:25:32+01 f:('a -> bool) -> 'a t -> 'a t 2
./src/array.mli filter 2017-04-06 12:41:19+02 'a t -> f:('a -> bool) -> 'a t 2
./src/array.mli filteri 2017-03-02 18:25:32+01 f:(int -> 'a -> bool) -> 'a t -> 'a t 2
./src/array.mli filteri 2017-04-06 12:41:19+02 'a t -> f:(int -> 'a -> bool) -> 'a t 2
./src/array.mli is_sorted 2017-03-02 18:25:32+01 'a t -> cmp:('a -> 'a -> int) -> bool 2
./src/array.mli is_sorted 2018-03-16 16:08:08+01 'a t -> compare:('a -> 'a -> int) -> bool 2
./src/array.mli is_sorted_strictly 2017-03-02 18:25:32+01 'a t -> cmp:('a -> 'a -> int) -> bool 2
filepath functionname min arguments count
./belt_Array.mli copy 2018-02-08 05:10:35+01 'a array -> 'a array 2
./belt_Array.mli copy 2018-04-05 04:24:56+02 'a array -> ((_)[@bs.as 0]) -> 'a array 2
./belt_Array.mli partition 2018-05-23 08:05:23+02 ('a -> bool) -> 'a array -> ('a array * 'a array) 2
./belt_Array.mli partition 2018-05-23 12:26:04+02 'a array -> ('a -> bool) -> ('a array * 'a array) 2
./belt_Id.mli comparable 2018-02-08 05:10:35+01 cmp:('a -> 'a -> int) -> (module Comparable with type t = 'a) 2
./belt_Id.mli comparable 2018-03-06 09:23:43+01 ('a -> 'a -> int) -> (module Comparable with type t = 'a) 2
./belt_Id.mli comparableU 2018-02-08 05:10:35+01 cmp:(('a -> 'a -> int)[@bs ]) -> (module Comparable with type t = 'a) 2
./belt_Id.mli comparableU 2018-03-06 09:23:43+01 (('a -> 'a -> int)[@bs ]) -> (module Comparable with type t = 'a) 2
./belt_List.mli reduceReverse 2018-02-08 05:10:35+01 'a t -> 'b -> ('a -> 'b -> 'b) -> 'b 2
@joelonsql
joelonsql / re2_confusing_test.md
Last active December 19, 2018 12:25
RE2 confusing test

re2/testing/search_test.cc contains a list of (regexp,text) pairs, where the text is tested against the regexp.

The only thing that is being tested for, is that the kEngineBacktrack engine (the "gold standard" engine) gives the same result as the other engines.

This means changing the regexp or text has no effect whatsoever in the test result.

To make the test more useful, I suggest adding a third bool value to manually specify for each test

(*
ocamldep .Re0.eobjs/Letter2Set.ml.d (exit 2)
(cd _build/default && /Users/joel/.opam/ocaml-base-compiler/bin/ocamldep.opt -modules -impl Letter2Set.ml) > _build/default/.Re0.eobjs/Letter2Set.ml.d
File "Letter2Set.ml", line 11, characters 4-8:
Error: Syntax error
*)
module Pair =
(* Original OCaml code: *)
let flatten_transitions : StateSet.t CharSetMap.t -> StateSet.t CharMap.t =
fun char_map ->
CharSetMap.fold
(fun char_set state_set char_map ->
CharSet.fold
(fun char char_map ->
let entry = match CharMap.find char char_map with
| exception Not_found -> StateSet.empty
@joelonsql
joelonsql / jpipe2sprintf.pl
Last active April 3, 2019 11:33
Script to convert Bucklescript string interpolation to normal OCaml using Printf.sprintf
#!/usr/bin/perl
#
# jpipe2sprintf
#
# Script to convert Bucklescript string interpolation [1]
# to normal OCaml using Printf.sprintf.
#
# Note: It replaces any such occurrences, even inside comments.
# If anyone would like to fix this script to leave comments
# untouched, such a patch would be most welcomed.