text
stringlengths
12
786k
module M : sig type ( ' a , ' b ) t = A of ' a type ( ' b , ' a ) t = A of ' a end ; ; Modules do not match : sig type ( ' b , ' a ) t = A of ' a end is not included in sig type ( ' a , ' b ) t = A of ' a end Type declarations do not match : type ( ' b , ...
module M ( X : sig type ' a t end ) = struct module Tag_internal = struct type ( ' variant , ' args ) create = | Args of ( ' args -> ' variant ) | Const of ' variant type ( ' variant , ' args ) t = { label : string ; rep : ' args X . t ; arity : int ; args_labe...
module type S = sig type ' a t include module type of M ( struct type ' a rep = ' a t type ' a t = ' a rep end ) end
let decvarint ( s : string ) string : int64 = let dec = D . of_string s in D . int64_as_varint dec
let encvarint ( i : int64 ) int64 : string = let enc = E . create ( create ) create in E . int64_as_varint i enc ; E . to_string enc
let str_to_l s = let l = ref [ ] in String . iter ( fun x -> l := x :: ! l ) l s ; List . rev ! l
let str_to_il s = str_to_l s |> List . map Char . code
let ( ) = let s = encvarint 12L in assert ( str_to_il s = [ 12 ] 12 ) 12 ; assert ( decvarint s = 12L ) 12L
let ( ) = let s = encvarint 0L in assert ( str_to_il s = [ 0 ] 0 ) 0 ; assert ( decvarint s = 0L ) 0L
let ( ) = let s = encvarint 127L in assert ( str_to_il s = [ 127 ] 127 ) 127 ; assert ( decvarint s = 127L ) 127L
let ( ) = let s = encvarint 128L in assert ( str_to_il s = [ 128 ; 1 ] 1 ) 1 ; assert ( decvarint s = 128L ) 128L
let ( ) = let s = encvarint 300L in assert ( str_to_il s = [ 0b1010_1100 ; 0b0000_0010 ] 0b0000_0010 ) 0b0000_0010 ; assert ( decvarint s = 300L ) 300L
let ( ) = let s = encvarint 150L in assert ( str_to_il s = [ 0x96 ; 1 ] 1 ) 1 ; assert ( decvarint s = 150L ) 150L
let ( ) = let s = encvarint 178282982111149L in assert ( str_to_il s = [ 173 ; 239 ; 197 ; 238 ; 219 ; 196 ; 40 ] 40 ) 40 ; assert ( decvarint s = 178282982111149L ) 178282982111149L
let setupMethod = ref pointer
let derefMethod = ref drawarray
let setupPointers ( ) = let vertices = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 25 . ; 25 . ; 100 . ; 325 . ; 175 . ; 25 . ; 175 . ; 325 . ; 250 . ; 25 . ; 325 . ; 325 . ; ] | and colors = Bigarray . Array1...
let setupInterleave ( ) = let intertwined = Bigarray . Array1 . of_array Bigarray . float32 Bigarray . c_layout [ | 1 . 0 ; 0 . 2 ; 1 . 0 ; 100 . 0 ; 100 . 0 ; 0 . 0 ; 1 . 0 ; 0 . 2 ; 0 . 2 ; 0 . 0 ; 200 . 0 ; 0 . 0 ; 1 . 0 ; ...
let init ( ) = glClearColor 0 . 0 0 . 0 0 . 0 0 . 0 ; glShadeModel GL_SMOOTH ; setupPointers ( ) ; ; ;
let display ( ) = glClear [ GL_COLOR_BUFFER_BIT ] ; if ( ! derefMethod = drawarray ) then glDrawArrays GL_TRIANGLES 0 6 else if ( ! derefMethod = arrayelement ) then begin glBegin GL_TRIANGLES ; glArrayElement 2 ; glArrayElement 3 ; glArrayElement 5 ; glEnd ( ) ; end else if ( ...
let reshape ~ width : w ~ height : h = glViewport 0 0 w h ; glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; gluOrtho2D 0 . 0 ( float w ) 0 . 0 ( float h ) ; ; ;
let mouse ~ button ~ state ~ x ~ y = match button , state with | GLUT_LEFT_BUTTON , GLUT_DOWN -> if ( ! setupMethod = pointer ) then begin setupMethod := interleaved ; setupInterleave ( ) ; end else if ( ! setupMethod = interleaved ) then begin setupMethod := pointer ; setupPointers (...
let keyboard ~ key ~ x ~ y = match key with | ' \ 027 ' -> exit 0 ; | _ -> ( ) ; ;
let ( ) = ignore ( glutInit Sys . argv ) ; glutInitDisplayMode [ GLUT_SINGLE ; GLUT_RGB ] ; glutInitWindowSize 350 350 ; glutInitWindowPosition 100 100 ; ignore ( glutCreateWindow Sys . argv . ( 0 ) ) ; let gl_version = glGetString GL_VERSION in if gl_version < " 1 . 1...
let names bounded env = Env . fold ( fun n _ bounded -> S . add n bounded ) env bounded
let rec fv_pat bounded acc p = match p . p_desc with | Ewildpat | Econstr0pat _ | Econstpat _ -> acc | Evarpat ( x ) -> if ( S . mem x acc ) || ( S . mem x bounded ) then acc else S . add x acc | Econstr1pat ( _ , pat_list ) | Etuplepat ( pat_list ) -> List . fold_left ( ...
let fv_block fv_local fv_body bounded acc { b_env = b_env ; b_locals = l_list ; b_body = body ; b_write = defnames } = let bounded = names bounded b_env in let bounded , acc = List . fold_left fv_local ( bounded , acc ) l_list in bounded , fv_body bounded acc body
let fv_match_handler fv_body m_h_list bounded acc = List . fold_left ( fun acc { m_pat = pat ; m_body = b ; m_env = env } -> fv_body ( names bounded env ) acc b ) acc m_h_list
let rec size acc { desc = desc } = match desc with | Sconst _ | Sglobal _ -> acc | Sname ( n ) -> S . add n acc | Sop ( _ , s1 , s2 ) -> size ( size acc s1 ) s2
let operator acc = function | Efby | Eunarypre | Eifthenelse | Etest | Eminusgreater | Eup | Einitial | Edisc | Ehorizon | Eaccess | Eupdate | Econcat | Eatomic -> acc | Eslice ( s1 , s2 ) -> size ( size acc s1 ) s2
let rec fv bounded ( last_acc , acc ) e = match e . e_desc with | Eop ( op , e_list ) -> let last_acc , acc = List . fold_left ( fv bounded ) ( last_acc , acc ) e_list in last_acc , operator acc op | Econstr1 ( _ , e_list ) | Etuple ( e_list ) -> List . fold_left ( fv...
let fve acc e = let acc_last , acc = fv S . empty ( S . empty , acc ) e in S . union acc_last acc
let empty_vcf = " ## fileformat = VCFv4 . 1 ## source = VarScan2 ## FORMAT =< ID = GT , Number = 1 , Type = String , Description " =\ Genotype " \> # CHROM \ tPOS \ tID \ tREF \ tALT \ tQUAL \ tFILTER \ tINFO \ tFORMAT \ tNORMAL \ tTUMOR "
let somatic_on_region ~ run_with ? adjust_mapq ~ normal ~ tumor ~ result_prefix region = let open KEDSL in let name = Filename . basename result_prefix in let result_file suffix = result_prefix ^ suffix in let varscan_tool = Machine . get_tool run_with Machine . Tool . Default . varscan in let snp_o...
let somatic_map_reduce ( ? more_edges = [ ] ) ~ run_with ? adjust_mapq ~ normal ~ tumor ~ result_prefix ( ) = let run_on_region region = let result_prefix = result_prefix ^ " " - ^ Region . to_filename region in somatic_on_region ~ run_with ? adjust_mapq ~ normal ~ tumor ~ result_pre...
type t = private [ > ] ; ;
type u = private [ > ] ~ [ t ] ; ;
type v = [ t | u ] ; ;
let f x = ( x : t :> v ) ; ;
module Mix ( X : sig type t = private [ > ] end ) ( Y : sig type t = private [ > ] end ) = struct type t = [ X . t | Y . t ] end ; ;
module Mix ( X : sig type t = private [ > ` A of int ] end ) ( Y : sig type t = private [ > ` A of bool ] ~ [ X . t ] end ) = struct type t = [ X . t | Y . t ] end ; ;
module Mix ( X : sig type t = private [ > ` A of int ] end ) ( Y : sig type t = private [ > ` A of int ] ~ [ X . t ] end ) = struct type t = [ X . t | Y . t ] end ; ;
module Mix ( X : sig type t = private [ > ` A of int ] end ) ( Y : sig type t = private [ > ` B of bool ] ~ [ X . t ] end ) = struct type t = [ X . t | Y . t ] end ; ;
type ' a t = private [ > ` L of ' a ] ~ [ ` L ] ; ;
module Mix ( X : sig type t = private [ > ` A of int ] ~ [ ` B ] end ) ( Y : sig type t = private [ > ` B of bool ] ~ [ X . t ] end ) = struct type t = [ X . t | Y . t ] let is_t = function # t -> true | _ -> false end ; ;
module Mix ( X : sig type t = private [ > ` A of int ] ~ [ ` B ] end ) ( Y : sig type t = private [ > ` B of bool ] ~ [ X . t ] end ) = struct type t = [ X . t | Y . t ] let which = function # X . t -> ` X | # Y . t -> ` Y end ; ;
module Mix ( I : sig type t = private [ > ] ~ [ ` A ; ` B ] end ) ( X : sig type t = private [ > I . t | ` A of int ] ~ [ ` B ] end ) ( Y : sig type t = private [ > I . t | ` B of bool ] ~ [ X . t ] end ) = struct type t = [ X . t | Y . t ] ...
module M = Mix ( struct type t = [ ` C of char ] end ) ( struct type t = [ ` A of int | ` C of char ] end ) ( struct type t = [ ` B of bool | ` C of char ] end ) ; ;
module M = Mix ( struct type t = [ ` B of bool ] end ) ( struct type t = [ ` A of int | ` B of bool ] end ) ( struct type t = [ ` B of bool | ` C of char ] end ) ; ;
module M1 = struct type t = [ ` A of int | ` C of char ] end
module M2 = struct type t = [ ` B of bool | ` C of char ] end
module I = struct type t = [ ` C of char ] end
module M = Mix ( I ) ( M1 ) ( M2 ) ; ;
let c = ( ` C ' c ' : M . t ) ; ;
module M ( X : sig type t = private [ > ` A ] end ) = struct let f ( # X . t as x ) = x end ; ;
type t = private [ > ` A ] ~ [ ` B ] ; ;
module M : sig type t = private [ > ` A of int | ` B ] ~ [ ` C ] end = struct type t = [ ` A of int | ` B | ` D of bool ] end ; ;
let f = function ( ` C | # M . t ) -> 1 + 1 ; ;
let f = function ( ` A _ | ` B # M . t ) -> 1 + 1 ; ;
module Mix ( X : sig type t = private [ > ] val show : t -> string end ) ( Y : sig type t = private [ > ] ~ [ X . t ] val show : t -> string end ) = struct type t = [ X . t | Y . t ] let show : t -> string = function # X . t as x -> X . show x | # Y . t as y -> ...
module EStr = struct type t = [ ` Str of string ] let show ( ` Str s ) = s end
module EInt = struct type t = [ ` Int of int ] let show ( ` Int i ) = string_of_int i end
module type T = sig type t = private [ > ] val show : t -> string end
module Mix ( X : T ) ( Y : T with type t = private [ > ] ~ [ X . t ] ) : T with type t = [ X . t | Y . t ] = struct type t = [ X . t | Y . t ] let show = function # X . t as x -> X . show x | # Y . t as y -> Y . show y end ; ;
module M : sig type t = private [ > ` A ] end = struct type t = [ ` A ] end
module M ' : sig type t = private [ > ] end = struct type t = [ M . t | ` A ] end ; ;
type t = private [ > ]
type u = private [ > ` A of int ] ~ [ t ] ; ;
type t = private [ > ` A of int ]
type u = private [ > ` A of int ] ~ [ t ] ; ;
module F ( X : sig type t = private [ > ] ~ [ ` A ; ` B ; ` C ; ` D ] type u = private [ > ` A ` | B ` | C ] ~ [ t ; ` D ] open X let f = function # u -> 1 | # t -> 2 | ` D -> 3 let g = function # u |# t ` | D -> 2 type v = [ t | u ` | D ] ...
module M = struct type t = private [ > ` A ] end ; ;
module M ' : sig type t = private [ > ] ~ [ ` A ] end = M ; ;
module type T = sig type t = private [ > ] ~ [ ` A ] end ; ;
module type T ' = T with type t = private [ > ` A ] ; ;
type t = private [ > ] ~ [ ` A ]
let f = function ` A x -> x | # t -> 0
type t ' = private [ < ` A of int | t ] ; ;
module F ( X : sig end ) : sig type t = private [ > ] type u = private [ > ] ~ [ t ] end = struct type t = [ ` A ] type u = [ ` B ] end
let f = function # M . t -> 1 | # M . u -> 2
let f = function # M . t -> 1 | _ -> 2
type t = [ M . t | M . u ]
let f = function # t -> 1 | _ -> 2 ; ;
module G ( X : sig type t = private [ > ] type u = private [ > ] ~ [ t ] end ) = struct let f = function # X . t -> 1 | _ -> 2 end ; ;
module M1 = G ( struct module N = F ( String ) type t = N . t type u = N . u end ) ; ;
module M1 = G ( struct type t = M . t type u = M . u end ) ; ;
let f = function # F ( String ) . t -> 1 | _ -> 2 ; ;
type t = [ F ( String ) . t | M . u ]
let f = function # t -> 1 | _ -> 2 ; ;
module N : sig type t = private [ > ] end = struct type t = [ F ( String ) . t | M . u ] end ; ;
type a = [ ` A of int | ` B ]
type b = [ ` A of bool | ` B ]
type c = private [ > ] ~ [ a ; b ]
let f = function # c -> 1 | ` A x -> truncate x
type d = private [ > ] ~ [ a ]
let g = function # d -> 1 | ` A x -> truncate x ; ;
type num = [ ` Num of int ]
module type Exp = sig type t = private [ > num ] val eval : t -> t val show : t -> string end
module Num ( X : Exp ) = struct type t = num let eval ( ` Num _ as x ) : X . t = x let show ( ` Num n ) = string_of_int n end
type ' a add = [ ` Add of ' a * ' a ]