text stringlengths 0 601k |
|---|
module MappingMap = UCharTbl . Make ( MappingHash ) |
let mapping_to_list index = function | Diff ( 0 ) 0 -> [ index ] index | Diff ( diff ) diff -> [ UChar . of_int ( ( UChar . code index ) index + diff ) diff ] diff | List l -> l |
module type Type = sig val map_b1b2 : unit -> MappingMap . t val map_b1 : unit -> MappingMap . t val saslprep_map : unit -> MappingMap . t val nodeprep_prohibited : unit -> UCharTbl . Bool . t val resourceprep_prohibited : unit -> UCharTbl . Bool . t val nameprep_prohibited : unit -> UCharTbl . Bool . t val saslprep_pr... |
module Make ( MakeConfig : ConfigInt . Type ) Type : Type = struct module UData = Unidata . Make ( MakeConfig ) MakeConfig let map_b1b2 ( ) = UData . read_data " map_b1b2 " let map_b1 ( ) = UData . read_data " map_b1 " let saslprep_map ( ) = UData . read_data " saslprep_map " let nodeprep_prohibited ( ) = UData . read_... |
let suite = suite " String " ( fun ( ) -> let open String in testAll " fromChar " [ ( ' a ' , " a ) " ; ( ' z ' , " z ) " ; ( ' ' , " ) " ; ( ' \ n ' , " \ n ) " ] ( fun ( char , string ) string -> expect ( fromChar char ) char |> toEqual Eq . string string ) ; describe " fromArray " ( fun ( ) -> test " creates an empt... |
module Configuration = struct type t = { name : string ; use_reference_gtf : bool ; } let to_json { name ; use_reference_gtf } : Yojson . Basic . json = ` Assoc [ " name " , ` String name ; " use - reference - gtf " , ` Bool use_reference_gtf ; ] let default = { name = " default " ; use_reference_gtf = true } end |
let run ~ configuration ( ~ run_with : Machine . t ) ~ bam ~ result_prefix ( ) = let open KEDSL in let name = sprintf " stringtie -% s " ( Filename . basename result_prefix ) in let result_file suffix = result_prefix ^ suffix in let output_dir = result_file " - stringtie_output " in let output_file_path = output_dir //... |
let s = Bytes . make 10 ' \ x00 ' |
let empty_s = Bytes . create 0 |
let assert_bound_check2 f v1 v2 = try ignore ( f v1 v2 ) ; assert false with | Invalid_argument _ -> ( ) |
let assert_bound_check3 f v1 v2 v3 = try ignore ( f v1 v2 v3 ) ; assert false with | Invalid_argument _ -> ( ) |
let ( ) = assert_bound_check2 caml_bytes_get_16 s ( - 1 ) ; assert_bound_check2 caml_bytes_get_16 s 9 ; assert_bound_check2 caml_bytes_get_32 s ( - 1 ) ; assert_bound_check2 caml_bytes_get_32 s 7 ; assert_bound_check2 caml_bytes_get_64 s ( - 1 ) ; assert_bound_check2 caml_bytes_get_64 s 3 ; assert_bound_check3 caml_byt... |
let swap16 x = if Sys . big_endian then bswap16 x else x |
let swap32 x = if Sys . big_endian then bswap32 x else x |
let swap64 x = if Sys . big_endian then bswap64 x else x |
let ( ) = caml_bytes_set_16 s 0 ( swap16 0x1234 ) ; Printf . printf " % x % x % x \ n " %! ( swap16 ( caml_bytes_get_16 s 0 ) ) ( swap16 ( caml_bytes_get_16 s 1 ) ) ( swap16 ( caml_bytes_get_16 s 2 ) ) ; caml_bytes_set_16 s 0 ( swap16 0xFEDC ) ; Printf . printf " % x % x % x \ n " %! ( swap16 ( caml_bytes_get_16 s 0 ) ... |
let ( ) = caml_bytes_set_32 s 0 ( swap32 0x12345678l ) ; Printf . printf " % lx % lx % lx \ n " %! ( swap32 ( caml_bytes_get_32 s 0 ) ) ( swap32 ( caml_bytes_get_32 s 1 ) ) ( swap32 ( caml_bytes_get_32 s 2 ) ) ; caml_bytes_set_32 s 0 ( swap32 0xFEDCBA09l ) ; Printf . printf " % lx % lx % lx \ n " %! ( swap32 ( caml_byt... |
let ( ) = caml_bytes_set_64 s 0 ( swap64 0x1234567890ABCDEFL ) ; Printf . printf " % Lx % Lx % Lx \ n " %! ( swap64 ( caml_bytes_get_64 s 0 ) ) ( swap64 ( caml_bytes_get_64 s 1 ) ) ( swap64 ( caml_bytes_get_64 s 2 ) ) ; caml_bytes_set_64 s 0 ( swap64 0xFEDCBA0987654321L ) ; Printf . printf " % Lx % Lx % Lx \ n " %! ( s... |
let ( ) = let module E = String . Escaping in let escape = Staged . unstage ( E . escape ~ escapeworthy [ ' : x ' ; ' y ' ; ' z ' ] ~ escape_char ' ' ) :\\ in let unescape = Staged . unstage ( E . unescape ~ escape_char ' ' ) :\\ in let rex = Pcre . regexp " [ xyz ] " \\\\ in let unrex = Pcre . regexp " . " \\\\ in let... |
__LOC__ , ( fun _ -> Eq ( caml_string_get_16 " 2 \ 000 " 0 , 50 ) 50 ) 50 ; __LOC__ , ( fun _ -> Eq ( caml_string_get_16 " 20 " 0 , 12338 ) 12338 ) 12338 ; __LOC__ , ( fun _ -> Eq ( Eqcaml_string_get_32 " 0123 " 0 , 858927408l ) 858927408l ) 858927408l ; __LOC__ , ( fun _ -> Eq ( Eqcaml_string_get_32 " 0123 " 0 , 85892... |
type ' a t = ( key , ' a ) ' a Hashtbl_gen . t |
let key_index ( h : _ t ) ( key : key ) key = ( Bs_hash_stubs . hash_string key ) land ( Array . length h . data - 1 ) 1 |
type ( ' a , ' b ) ' b bucketlist = ( ' a , ' b ) ' b Hashtbl_gen . bucketlist |
let add ( h : _ t ) t key info = let i = key_index h key in let h_data = h . data in Array . unsafe_set h_data i ( Cons ( Conskey , info , ( Array . unsafe_get h_data i ) i ) i ) i ; h . size <- h . size + 1 ; if h . size > Array . length h_data lsl 1 then Hashtbl_gen . resize key_index h |
let modify_or_init ( h : _ t ) t key modf default = let rec find_bucket ( bucketlist : _ bucketlist ) bucketlist = match bucketlist with | Cons ( Consk , i , next ) next -> if eq_key k key then begin modf i ; false end else find_bucket next | Empty -> true in let i = key_index h key in let h_data = h . data in if find_... |
let rec remove_bucket key ( h : _ t ) t ( bucketlist : _ bucketlist ) bucketlist : _ bucketlist = match bucketlist with | Empty -> Empty | Cons ( Consk , i , next ) next -> if eq_key k key then begin h . size <- h . size - 1 ; next end else Cons ( Consk , i , remove_bucket key h next ) next |
let remove ( h : _ t ) key = let i = key_index h key in let h_data = h . data in let old_h_szie = h . size in let new_bucket = remove_bucket key h ( Array . unsafe_get h_data i ) i in if old_h_szie <> h . size then Array . unsafe_set h_data i new_bucket |
let rec find_rec key ( bucketlist : _ bucketlist ) bucketlist = match bucketlist with | Empty -> raise Not_found | Cons ( Consk , d , rest ) rest -> if eq_key key k then d else find_rec key rest |
let find_exn ( h : _ t ) t key = match Array . unsafe_get h . data ( key_index h key ) key with | Empty -> raise Not_found | Cons ( Consk1 , d1 , rest1 ) rest1 -> if eq_key key k1 then d1 else match rest1 with | Empty -> raise Not_found | Cons ( Consk2 , d2 , rest2 ) rest2 -> if eq_key key k2 then d2 else match rest2 w... |
let find_opt ( h : _ t ) t key = Hashtbl_gen . small_bucket_opt eq_key key ( Array . unsafe_get h . data ( key_index h key ) key ) key |
let find_key_opt ( h : _ t ) t key = Hashtbl_gen . small_bucket_key_opt eq_key key ( Array . unsafe_get h . data ( key_index h key ) key ) key |
let find_default ( h : _ t ) t key default = Hashtbl_gen . small_bucket_default eq_key key default ( Array . unsafe_get h . data ( key_index h key ) key ) key |
let find_all ( h : _ t ) t key = let rec find_in_bucket ( bucketlist : _ bucketlist ) bucketlist = match bucketlist with | Empty -> [ ] | Cons ( Consk , d , rest ) rest -> if eq_key k key then d :: find_in_bucket rest else find_in_bucket rest in find_in_bucket ( Array . unsafe_get h . data ( key_index h key ) key ) key |
let replace h key info = let rec replace_bucket ( bucketlist : _ bucketlist ) bucketlist : _ bucketlist = match bucketlist with | Empty -> raise_notrace Not_found | Cons ( Consk , i , next ) next -> if eq_key k key then Cons ( Conskey , info , next ) next else Cons ( Consk , i , replace_bucket next ) next in let i = ke... |
let mem ( h : _ t ) t key = let rec mem_in_bucket ( bucketlist : _ bucketlist ) bucketlist = match bucketlist with | Empty -> false | Cons ( Consk , d , rest ) rest -> eq_key k key || mem_in_bucket rest in mem_in_bucket ( Array . unsafe_get h . data ( key_index h key ) key ) key |
let of_list2 ks vs = let len = List . length ks in let map = create len in List . iter2 ( fun k v -> add map k v ) v ks vs ; map |
let key_index ( h : _ Hash_set_gen . t ) ( key : key ) key = ( Bs_hash_stubs . hash_string key ) key land ( Array . length h . data - 1 ) 1 |
type t = key Hash_set_gen . t |
let remove ( h : _ Hash_set_gen . t ) t key = let i = key_index h key in let h_data = h . data in let old_h_size = h . size in let new_bucket = Hash_set_gen . remove_bucket eq_key key h ( Array . unsafe_get h_data i ) i in if old_h_size <> h . size then Array . unsafe_set h_data i new_bucket |
let add ( h : _ Hash_set_gen . t ) t key = let i = key_index h key in let h_data = h . data in let old_bucket = ( Array . unsafe_get h_data i ) i in if not ( Hash_set_gen . small_bucket_mem eq_key key old_bucket ) old_bucket then begin Array . unsafe_set h_data i ( key :: old_bucket ) old_bucket ; h . size <- h . size ... |
let of_array arr = let len = Array . length arr in let tbl = create len in for i = 0 to len - 1 do add tbl ( Array . unsafe_get arr i ) i ; done ; tbl |
let check_add ( h : _ Hash_set_gen . t ) t key = let i = key_index h key in let h_data = h . data in let old_bucket = ( Array . unsafe_get h_data i ) i in if not ( Hash_set_gen . small_bucket_mem eq_key key old_bucket ) old_bucket then begin Array . unsafe_set h_data i ( key :: old_bucket ) old_bucket ; h . size <- h .... |
let mem ( h : _ Hash_set_gen . t ) t key = Hash_set_gen . small_bucket_mem eq_key key ( Array . unsafe_get h . data ( key_index h key ) key ) key |
module Make_with_validate_without_pretty_printer ( M : sig val module_name : string val validate : string -> unit Or_error . t end ) ( ) = struct module Stable = struct module V1 = struct module T = struct type t = string [ @@ deriving sexp , compare , equal , hash ] let check_for_whitespace = let invalid s reason = Er... |
module Make_without_pretty_printer ( M : sig val module_name : string end ) ( ) = struct include Make_with_validate_without_pretty_printer ( struct let module_name = M . module_name let validate = Fn . const ( Ok ( ) ) end ) ( ) end |
module Make_with_validate ( M : sig val module_name : string val validate : string -> unit Or_error . t end ) ( ) = struct include Make_with_validate_without_pretty_printer ( M ) ( ) include Pretty_printer . Register ( struct type nonrec t = t let module_name = M . module_name let to_string = to_string end ) end |
module Make ( M : sig val module_name : string end ) ( ) = struct include Make_without_pretty_printer ( M ) ( ) include Pretty_printer . Register ( struct type nonrec t = t let module_name = M . module_name let to_string = to_string end ) end ( struct let module_name = " Core_kernel . String_id " end ) ( ) |
module type S = sig type t = private string [ @@ deriving equal , hash ] include Identifiable with type t := t include Quickcheckable . S with type t := t module Stable : sig module V1 : sig type nonrec t = t [ @@ deriving equal , hash ] include Stringable . S with type t := t include Stable_comparable . V1 with type t... |
module type String_id = sig module type S = S include S module Make ( M : sig val module_name : string end ) ( ) : S module Make_with_validate ( M : sig val module_name : string val validate : string -> unit Or_error . t end ) ( ) : S module Make_without_pretty_printer ( M : sig val module_name : string end ) ( ) : S m... |
let hi2 xx yy ( zz : int ) int = { j | $ zz | j } j |
let hi a0 b0 xx yy zz = { j | $ zz | j } j |
let a0 = { js | Hello \\| js } js |
let a1 = { j | Hello \\| j } j |
let a2 = { j | Hello \$| j } j |
let a3 world = { j | Hello \\$ world | j } j |
let a5 x = { j |$ x | j } j |
let a6 x = { j ( |$ x ) x | j } j |
let a7 x0 x3 x5 = { j |\\$ x0 , \$ x1 , \\\$ x2 , \\\\$ x3 , \\\\\$ x4 , \\\\\\$ x5 | j } j |
let ffff a_1 a_2 = { j | hello $ a_1 , wlecome to ( $ a_2 ) a_2 | j } j |
let f x y = let sum = x + y in Js . log { j | $ x + $ y = $ sum | j } j |
let test1 x0 = { j | 你好 ,$ x0 | j } j |
let test3 _xg = { j | 你好 ,$ _xg | j } j |
let test5 x = { j ( |$ x ) x | j } j |
type buf = { str : string ; mutable pos : int ; len : int } |
let open_in str = { str ; pos = 0 ; len = String . length str } |
module M = struct type ' a t = ' a let return a = a type conn = buf let ( >>= ) = ( |> ) type ic = buf type oc = Buffer . t let read_rest x = let s = String . sub x . str x . pos ( x . len - x . pos ) in x . pos <- x . len ; s let read_line ' x = if x . pos < x . len then let start = x . pos in try while x . str . [ x ... |
type ' a t = | Empty | Node of ' a t * string * ' a * ' a t * int |
let height = function Empty -> 0 | Node ( _ , _ , _ , _ , h ) -> h |
let create l x d r = let hl = height l and hr = height r in Node ( l , x , d , r , ( if hl >= hr then hl + 1 else hr + 1 ) ) |
let singleton x d = Node ( Empty , x , d , Empty , 1 ) |
let bal l x d r = let hl = match l with Empty -> 0 | Node ( _ , _ , _ , _ , h ) -> h in let hr = match r with Empty -> 0 | Node ( _ , _ , _ , _ , h ) -> h in if hl > hr + 2 then begin match l with Empty -> invalid_arg " Map . bal " | Node ( ll , lv , ld , lr , _ ) -> if height ll >= height lr then create ll lv ld ( cre... |
let is_empty = function Empty -> true | _ -> false |
let rec add x data = function Empty -> Node ( Empty , x , data , Empty , 1 ) | Node ( l , v , d , r , h ) -> let c = String . compare x v in if c = 0 then Node ( l , x , data , r , h ) else if c < 0 then bal ( add x data l ) v d r else bal l v d ( add x data r ) |
let rec find x = function Empty -> raise Not_found | Node ( l , v , d , r , _ ) -> let c = String . compare x v in if c = 0 then d else find x ( if c < 0 then l else r ) |
let rec mem x = function Empty -> false | Node ( l , v , d , r , _ ) -> let c = String . compare x v in c = 0 || mem x ( if c < 0 then l else r ) |
let rec min_binding = function Empty -> raise Not_found | Node ( Empty , x , d , r , _ ) -> ( x , d ) | Node ( l , x , d , r , _ ) -> min_binding l |
let rec max_binding = function Empty -> raise Not_found | Node ( l , x , d , Empty , _ ) -> ( x , d ) | Node ( l , x , d , r , _ ) -> max_binding r |
let rec remove_min_binding = function Empty -> invalid_arg " Map . remove_min_elt " | Node ( Empty , x , d , r , _ ) -> r | Node ( l , x , d , r , _ ) -> bal ( remove_min_binding l ) x d r |
let merge t1 t2 = match ( t1 , t2 ) with ( Empty , t ) -> t | ( t , Empty ) -> t | ( _ , _ ) -> let ( x , d ) = min_binding t2 in bal t1 x d ( remove_min_binding t2 ) |
let rec remove x = function Empty -> Empty | Node ( l , v , d , r , h ) -> let c = String . compare x v in if c = 0 then merge l r else if c < 0 then bal ( remove x l ) v d r else bal l v d ( remove x r ) |
let rec iter f = function Empty -> ( ) | Node ( l , v , d , r , _ ) -> iter f l ; f v d [ @ bs ] ; iter f r |
let rec map f = function Empty -> Empty | Node ( l , v , d , r , h ) -> let l ' = map f l in let d ' = f d [ @ bs ] in let r ' = map f r in Node ( l ' , v , d ' , r ' , h ) |
let rec mapi f = function Empty -> Empty | Node ( l , v , d , r , h ) -> let l ' = mapi f l in let d ' = f v d [ @ bs ] in let r ' = mapi f r in Node ( l ' , v , d ' , r ' , h ) |
let rec fold f m accu = match m with Empty -> accu | Node ( l , v , d , r , _ ) -> fold f r ( f v d ( fold f l accu ) [ @ bs ] ) |
let rec for_all p = function Empty -> true | Node ( l , v , d , r , _ ) -> p v d [ @ bs ] && for_all p l && for_all p r |
let rec exists p = function Empty -> false | Node ( l , v , d , r , _ ) -> p v d [ @ bs ] || exists p l || exists p r |
let rec add_min_binding k v = function | Empty -> singleton k v | Node ( l , x , d , r , h ) -> bal ( add_min_binding k v l ) x d r |
let rec add_max_binding k v = function | Empty -> singleton k v | Node ( l , x , d , r , h ) -> bal l x d ( add_max_binding k v r ) |
let rec join l v d r = match ( l , r ) with ( Empty , _ ) -> add_min_binding v d r | ( _ , Empty ) -> add_max_binding v d l | ( Node ( ll , lv , ld , lr , lh ) , Node ( rl , rv , rd , rr , rh ) ) -> if lh > rh + 2 then bal ll lv ld ( join lr v d r ) else if rh > lh + 2 then bal ( join l v d rl ) rv rd rr else create l ... |
let concat t1 t2 = match ( t1 , t2 ) with ( Empty , t ) -> t | ( t , Empty ) -> t | ( _ , _ ) -> let ( x , d ) = min_binding t2 in join t1 x d ( remove_min_binding t2 ) |
let concat_or_join t1 v d t2 = match d with | Some d -> join t1 v d t2 | None -> concat t1 t2 |
let rec split x = function Empty -> ( Empty , None , Empty ) | Node ( l , v , d , r , _ ) -> let c = String . compare x v in if c = 0 then ( l , Some d , r ) else if c < 0 then let ( ll , pres , rl ) = split x l in ( ll , pres , join rl v d r ) else let ( lr , pres , rr ) = split x r in ( join l v d lr , pres , rr ) |
let rec merge f s1 s2 = match ( s1 , s2 ) with ( Empty , Empty ) -> Empty | ( Node ( l1 , v1 , d1 , r1 , h1 ) , _ ) when h1 >= height s2 -> let ( l2 , d2 , r2 ) = split v1 s2 in concat_or_join ( merge f l1 l2 ) v1 ( f v1 ( Some d1 ) d2 [ @ bs ] ) ( merge f r1 r2 ) | ( _ , Node ( l2 , v2 , d2 , r2 , h2 ) ) -> let ( l1 ,... |
let rec filter p = function Empty -> Empty | Node ( l , v , d , r , _ ) -> let l ' = filter p l in let pvd = p v d [ @ bs ] in let r ' = filter p r in if pvd then join l ' v d r ' else concat l ' r ' |
let rec partition p = function Empty -> ( Empty , Empty ) | Node ( l , v , d , r , _ ) -> let ( lt , lf ) = partition p l in let pvd = p v d [ @ bs ] in let ( rt , rf ) = partition p r in if pvd then ( join lt v d rt , concat lf rf ) else ( concat lt rt , join lf v d rf ) |
type ' a enumeration = End | More of string * ' a * ' a t * ' a enumeration |
let rec cons_enum m e = match m with Empty -> e | Node ( l , v , d , r , _ ) -> cons_enum l ( More ( v , d , r , e ) ) |
let compare cmp m1 m2 = let rec compare_aux e1 e2 = match ( e1 , e2 ) with ( End , End ) -> 0 | ( End , _ ) -> - 1 | ( _ , End ) -> 1 | ( More ( v1 , d1 , r1 , e1 ) , More ( v2 , d2 , r2 , e2 ) ) -> let c = String . compare v1 v2 in if c <> 0 then c else let c = cmp d1 d2 [ @ bs ] in if c <> 0 then c else compare_aux (... |
let equal cmp m1 m2 = let rec equal_aux e1 e2 = match ( e1 , e2 ) with ( End , End ) -> true | ( End , _ ) -> false | ( _ , End ) -> false | ( More ( v1 , d1 , r1 , e1 ) , More ( v2 , d2 , r2 , e2 ) ) -> String . compare v1 v2 = 0 && cmp d1 d2 [ @ bs ] && equal_aux ( cons_enum r1 e1 ) ( cons_enum r2 e2 ) in equal_aux (... |
let rec cardinal = function Empty -> 0 | Node ( l , _ , _ , r , _ ) -> cardinal l + 1 + cardinal r |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.