text stringlengths 0 601k |
|---|
let _ , _ , _ , bind_g = bind ~ directives [ : Comment " $ k " ] $ ~ file " : sect1 - bind . ladot " couple site_a site_b_x |
let add_state site state graph = let _ , graph = add_internal_state ~ directives [ : Direction se ] site state graph in ( [ ] , [ ] , [ ] ) , graph |
let activate ? directives ? file g s su sp = build_rule ? directives ? file g ( add_state s su ) ( add_state s sp ) |
let _ = let site_b_y , g = add_site agent_b b_y couple in let _ , g = add_bond site_a site_b_x g in activate ~ directives [ : Comment " $ kp " ] $ ~ file " : sect1 - phos . ladot " g site_b_y b_y_u b_y_p |
let refined_domain state = let s , g = add_site agent_b b_y couple in snd ( add_state s state g ) |
let _ , _ , _ , bind_u = bind ~ directives [ : Comment " $ k " ] $ ~ file " : sect1 - bind - ref - u . ladot " ( refined_domain b_y_u ) site_a site_b_x |
let _ , _ , _ , bind_p = bind ~ directives [ : Comment " $ k " ] $ ~ file " : sect1 - bind - ref - p . ladot " ( refined_domain b_y_p ) site_a site_b_x |
let ag , fictitious = add_empty_node 0 . 0 . signature |
let sigmafu , _ , bind_u = let g = move_remanent_right_to 0 . 2 bind_u fictitious in disjoint_union fictitious g |
let sigmafu = lift_agent sigmafu |
let sigmafp , _ , bind_p = let g = move_remanent_right_to 0 . 2 bind_p fictitious in disjoint_union fictitious g |
let sigmafp = lift_agent sigmafp |
let sigmad , sigmau , bindup = let bind_u = move_remanent_above 0 . 5 bind_u bind_p in disjoint_union bind_u bind_p |
let sigmad = lift_agent sigmad |
let sigmau = lift_agent sigmau |
let _ , sigmaf , bind_g = let g = move_remanent_right_to 0 . 2 fictitious bind_g in disjoint_union bind_g g |
let sigmaf = lift_agent sigmaf |
let sigmal , sigmar , graph = let g = move_remanent_right_to 1 . 5 bindup bind_g in disjoint_union ( translate_graph { abscisse = 0 . ; ordinate = 0 . 45 } bind_g ) g |
let sigmal = lift_agent sigmal |
let sigmar = lift_agent sigmar |
let fl = sigmal ( sigmaf ( ag ) ) |
let fu = sigmar ( sigmafu ( sigmau ag ) ) |
let fp = sigmar ( sigmafp ( sigmad ag ) ) |
let sigmau x = sigmar ( sigmaf ( sigmau x ) ) |
let graph = add_proj ~ color " : black " [ fl , fp ; fl , fu ] graph |
let _ = dump " ref . ladot " graph let [ a , [ a_n , [ ] ; a_e , [ u ; p ] ; ] ] , signature = add_in_signature [ " $\ text { \ agent { A } { } } " , $ [ Shape " circle " ; Width ( 0 . 13 . * config . agent_width ) ; Height ( 0 . 16 . * config . agent_width ) ] , [ " $\ text { \ site { n } { } { } } " , [ $ Direction n... |
let left g = let _ , g = add_free_list [ sn , [ ] ; sn ' , [ ] ] g in let _ , g = add_internal_state se ' ' ' u g in ( [ ] , [ ] , [ ] ) , g |
let right g = let g = add_link_list [ sn , sn ' ] g in let _ , g = add_internal_state se ' ' ' p g in ( [ ] , [ ] , [ ] ) , g |
let _ = build_rule ~ file " : auto . ladot " ~ directives [ : Comment " $ k " ] $ g left right let [ a , [ a_x , [ ] ; a_y , [ ] ; ] ; ] , signature = add_in_signature [ " $\ text { \ agent { A } { } } " , [ $ Shape " rectangle " ; Width ( 0 . 10 . * config . agent_width ) ; Height ( 0 . 16 . * config . agent_width ) ]... |
let [ agent_a , [ site_a , _ ; site_b , _ ] ; agent_a ' , [ site_a ' , _ ; site_b ' , _ ] ] , dimer = add_in_graph [ a , 0 . , 0 . , [ ] , [ a_x , [ ] , [ ] ; a_y , [ ] , [ ] ] ; a , 0 . 6 , 0 . , [ ] , [ a_x , [ Direction nw ] , [ ] ; a_y , [ Direction sw ] , [ ] ] ; ] signature |
let build_rule b1 b2 g = let sx , sy , s = if b1 then site_a , site_b , " t " else site_b , site_a , " f " in let sx ' , sy ' , s ' = if b2 then site_a ' , site_b ' , " t " else site_b ' , site_a ' , " f " in let n = if b1 && b2 then " 1 " else if b1 then " 3 " else if b2 then " 4 " else " 2 " in let file = " sym " ^ s... |
let _ = build_rule true true dimer |
let _ = build_rule false false dimer |
let _ = build_rule true false dimer |
module Meta = struct type user = [ ` beginner ] [ @@ deriving yaml ] let user_to_string = function ` beginner -> " beginner " type t = { title : string ; description : string ; date : string ; users : user list ; } [ @@ deriving yaml ] end |
module H = struct include Sesame . Collection . Html ( Meta ) let build ( t : Input . t ) = let { Meta . title ; users ; description ; _ } = t . meta in let users = div ~ a [ : a_class [ " user - list " ] ] ( List . map ( fun u -> span ~ a [ : a_class [ " tag " ; " is - danger " ] ] [ txt ( Meta . user_to_string u ) ] ... |
module C = Sesame . Collection . Make ( Meta ) |
module Fetch = Current_sesame . Make_watch ( Sesame . Utils . Dir ( C ) ) |
module Html = Current_sesame . Make ( Sesame . Utils . List ( H ) ) |
module Index = struct let to_html ( ts : C . t list Current . t ) = let open Current . Syntax in Current . component " Index File " |> let > ts = ts in let head = Components . simple_head ~ t " : Blog Posts " in let body = [ Components . navbar ; Components . section [ div ~ a [ : a_class [ " content " ; " columns " ] ... |
module State = struct module Clock_map = Map . Make ( Orx . Clock ) type t = Orx . Object . t Clock_map . t ref let state : t = ref Clock_map . empty let get ( ) = ! state let add ( clock : Orx . Clock . t ) ( o : Orx . Object . t ) : unit = state := Clock_map . add clock o ! state end |
let update ( clock_info : Orx . Clock . Info . t ) = Orx . Config . push_section " Main " ; if Orx . Config . get_bool " DisplayLog " then Orx . Log . log " <% s >: Time = . % 3f / DT = . % 3f " ( Orx . Clock . get_name ( Orx . Clock . Info . get_clock clock_info |> Option . get ) ) ( Orx . Clock . Info . get_time cloc... |
let input_update ( _clock_info : Orx . Clock . Info . t ) = Orx . Config . push_section " Main " ; if Orx . Input . has_been_activated " Log " then Orx . Config . set_bool " DisplayLog " ( not ( Orx . Config . get_bool " DisplayLog " ) ) ; Orx . Config . pop_section ( ) ; match Orx . Clock . get " Clock1 " with | None ... |
let init ( ) = let get_name ( binding : string ) : string = let ( type_ , id , mode ) = Orx . Input . get_binding binding 0 |> Result . get_ok in Orx . Input . get_binding_name type_ id mode in Orx . Log . log ( " . @- Press ' % s ' to toggle log display . " @ ^^ " - To stretch time for the first clock ( updating the b... |
let run ( ) = if Orx . Input . is_active " Quit " then Orx . Status . error else Orx . Status . ok |
let ( ) = Orx . Main . start ~ config_dir " : examples / tutorial / data " ~ init ~ run " 02_Clock " |
module State = struct type t = { soldier : Orx . Object . t ; music : Orx . Sound . t ; } let state : t option ref = ref None let get ( ) = Option . get ! state end |
let event_message ( event : Orx . Event . t ) ( sound_event_payload : Orx . Sound_event . payload ) kind = let sound = Orx . Sound_event . get_sound sound_event_payload in let recipient = Orx . Event . get_recipient_object event |> Option . get in Orx . Log . log " Sound [ % s ] [ @@% s ] has % s " ( Orx . Sound . get_... |
let event_handler ( event : Orx . Event . t ) ( sound_event : Orx . Sound_event . t ) ( payload : Orx . Sound_event . payload ) = let state = State . get ( ) in match Orx . Event . get_recipient_object event with | None -> Error ` Orx | Some recipient -> if Orx . Object . equal state . soldier recipient then ( match so... |
let update_state ( state : State . t ) ( clock_info : Orx . Clock . Info . t ) = if Orx . Input . has_been_activated " RandomSFX " then ( Orx . Object . add_sound_exn state . soldier " RandomBip " ; Orx . Config . push_section " Tutorial " ; Orx . Object . set_rgb state . soldier ( Orx . Config . get_vector " RandomCol... |
let update ( clock_info : Orx . Clock . Info . t ) = let state = State . get ( ) in if Orx . Input . has_been_activated " ToggleMusic " then Orx . Object . enable state . soldier ( not ( Orx . Object . is_enabled state . soldier ) ) ; if Orx . Object . is_enabled state . soldier then update_state state clock_info |
let init ( ) = let get_name ( binding : string ) : string = let ( type_ , id , mode ) = Orx . Input . get_binding binding 0 |> Result . get_ok in Orx . Input . get_binding_name type_ id mode in Orx . Log . log ( " . @- ' % s ' & ' % s ' will change the music volume ( + soldier size ) . " @ ^^ " - ' % s ' & ' % s ' will... |
let run ( ) = if Orx . Input . is_active " Quit " then Orx . Status . error else Orx . Status . ok |
let ( ) = Orx . Main . start ~ config_dir " : examples / tutorial / data " ~ init ~ run " 06_Sound " |
module State = struct type t = { soldier : Orx . Object . t ; mutable soldier_fx_lock : bool ; box : Orx . Object . t ; mutable selected_fx : string ; } let state : t option ref = ref None let get ( ) = Option . get ! state end |
let input_event_handler ( _event : Orx . Event . t ) ( _input : Orx . Input_event . t ) ( _payload : Orx . Input_event . payload ) = Ok ( ) |
let fx_event_handler ( event : Orx . Event . t ) ( fx_event : Orx . Fx_event . t ) ( payload : Orx . Fx_event . payload ) = let state = State . get ( ) in let recipient = Orx . Event . get_recipient_object event |> Option . get in ( match fx_event with | Start -> Orx . Log . log " FX <% s >@<% s > has started " ! ( Orx... |
let update ( _clock_info : Orx . Clock . Info . t ) = let state = State . get ( ) in let possible_fx_inputs = [ ( " SelectMultiFX " , " MultiFX " ) ; ( " SelectWobble " , " WobbleFX " ) ; ( " SelectCircle " , " CircleFX " ) ; ( " SelectFade " , " FadeFX " ) ; ( " SelectFlash " , " FlashFX " ) ; ( " SelectMove " , " Mov... |
let init ( ) = let get_name ( binding : string ) : string = let ( type_ , id , mode ) = Orx . Input . get_binding binding 0 |> Result . get_ok in Orx . Input . get_binding_name type_ id mode in Orx . Log . log ( " . @- To select the FX to apply . " :@ ^^ " . ' % s ' => Wobble . " @ ^^ " . ' % s ' => Circle . " @ ^^ " .... |
let run ( ) = if Orx . Input . is_active " Quit " then Orx . Status . error else Orx . Status . ok |
let ( ) = Orx . Main . start ~ config_dir " : examples / tutorial / data " ~ init ~ run " 07_FX " |
module State = struct type t = Orx . Camera . t let state : t option ref = ref None let get ( ) = Option . get ! state end |
let event_handler ( event : Orx . Event . t ) ( physics : Orx . Physics_event . t ) ( _payload : Orx . Physics_event . payload ) = ( match physics with | Contact_remove -> ( ) | Contact_add -> let sender = Orx . Event . get_sender_object event |> Option . get in let recipient = Orx . Event . get_recipient_object event ... |
let update ( clock_info : Orx . Clock . Info . t ) = let camera = State . get ( ) in let delta_rotation = if Orx . Input . is_active " RotateLeft " then Some ( 4 . 0 . * Orx . Clock . Info . get_dt clock_info ) else if Orx . Input . is_active " RotateRight " then Some ( - 4 . 0 . * Orx . Clock . Info . get_dt clock_inf... |
let init ( ) = let ( type_ , id , mode ) = Orx . Input . get_binding " RotateLeft " 0 |> Result . get_ok in let input_rotate_left = Orx . Input . get_binding_name type_ id mode in let ( type_ , id , mode ) = Orx . Input . get_binding " RotateRight " 0 |> Result . get_ok in let input_rotate_right = Orx . Input . get_bin... |
let run ( ) = if Orx . Input . is_active " Quit " then Orx . Status . error else Orx . Status . ok |
let ( ) = Orx . Main . start ~ config_dir " : examples / tutorial / data " ~ init ~ run " 08_Physics " |
module State = struct type t = Orx . Camera . t let state : t option ref = ref None let get ( ) = Option . get ! state end |
let update ( clock_info : Orx . Clock . Info . t ) = let camera = State . get ( ) in Orx . Config . push_section " Tutorial " ; let scroll_speed = Orx . Config . get_vector " ScrollSpeed " in Orx . Config . pop_section ( ) ; let scroll_speed = Orx . Vector . mulf scroll_speed ( Orx . Clock . Info . get_dt clock_info ) ... |
let init ( ) = let get_name ( binding : string ) : string = let ( type_ , id , mode ) = Orx . Input . get_binding binding 0 |> Result . get_ok in Orx . Input . get_binding_name type_ id mode in Orx . Log . log ( " . @- ' % s ' , ' % s ' , ' % s ' & ' % s ' will move the camera . " @ ^^ " - ' % s ' & ' % s ' will zoom i... |
let run ( ) = if Orx . Input . is_active " Quit " then Orx . Status . error else Orx . Status . ok |
let ( ) = Orx . Main . start ~ config_dir " : examples / tutorial / data " ~ init ~ run " 09_Scrolling " |
let cautious f ppf arg = try f ppf arg with Ellipsis -> fprintf ppf " . . . " |
let rec print_ident ppf = function Oide_ident s -> pp_print_string ppf s | Oide_dot ( id , s ) s -> print_ident ppf id ; pp_print_char ppf ' . ' ; pp_print_string ppf s | Oide_apply ( id1 , id2 ) id2 -> fprintf ppf " % a ( a % a ) a " print_ident id1 print_ident id2 # else |
let rec print_ident ppf = function Oide_ident s -> ! Oprint . out_ident ppf s | Oide_dot ( id , s ) s -> print_ident ppf id ; pp_print_char ppf ' . ' ; ! Oprint . out_ident ppf s | Oide_apply ( id1 , id2 ) id2 -> fprintf ppf " % a ( a % a ) a " print_ident id1 print_ident id2 # end |
let parenthesized_ident name = ( List . mem name [ " or " ; " mod " ; " land " ; " lor " ; " lxor " ; " lsl " ; " lsr " ; " asr ] ) " || ( match name [ . 0 ] 0 with ' a ' . . ' z ' | ' A ' . . ' Z ' | ' \ 223 ' . . ' \ 246 ' | ' \ 248 ' . . ' \ 255 ' | ' _ ' -> false | _ -> true ) true |
let value_ident ppf name = if parenthesized_ident name then fprintf ppf ( " % s ) " ( Reason_syntax_util . ml_to_reason_swap name ) name else pp_print_string ppf name |
let valid_float_lexeme s = let l = String . length s in let rec loop i = if i >= l then s ^ " . " else match s [ . i ] i with | ' 0 ' . . ' 9 ' | ' - ' -> loop ( i + 1 ) 1 | _ -> s in loop 0 |
let float_repres f = match classify_float f with FP_nan -> " nan " | FP_infinite -> if f < 0 . 0 then " neg_infinity " else " infinity " | _ -> let float_val = let s1 = Printf . sprintf " . % 12g " f in if f = float_of_string s1 then s1 else let s2 = Printf . sprintf " . % 15g " f in if f = float_of_string s2 then s2 e... |
let parenthesize_if_neg ppf fmt v isneg = if isneg then pp_print_char ppf ' ( ' ' ; fprintf ppf fmt v ; if isneg then pp_print_char ppf ' ) ' ' |
let print_out_value ppf tree = let rec print_tree_1 ppf = function | Oval_constr ( name , [ Oval_constr ( ( Oide_ident ( ) ) " " , [ ] ) ] ) -> fprintf ppf [ " @< 1 >% a ( a ) a ] " @ print_ident name | Oval_constr ( name , [ param ] param ) param -> fprintf ppf [ " @< 1 >% a ( a % a ) a ] " @ print_ident name print_co... |
let rec print_list_init pr sep ppf = function [ ] -> ( ) | a :: l -> sep ppf ; pr ppf a ; print_list_init pr sep ppf l |
let rec print_list pr sep ppf = function [ ] -> ( ) | [ a ] a -> pr ppf a | a :: l -> pr ppf a ; sep ppf ; print_list pr sep ppf l |
let pr_present = print_list ( fun ppf s -> fprintf ppf " ` % s " s ) s ( fun ppf -> fprintf ppf " @ ) " |
let pr_vars = print_list ( fun ppf s -> fprintf ppf " ' % s " s ) s ( fun ppf -> fprintf ppf " @ ) " |
type label = | Nonlabeled | Labeled of string | Optional of string |
let get_label lbl = if lbl = " " then Nonlabeled else if String . get lbl 0 = ' ? ' then Optional ( String . sub lbl 1 @@ String . length lbl - 1 ) 1 else Labeled lbl |
let rec print_out_type ppf = function | Otyp_alias ( ty , s ) s -> fprintf ppf [ " @% a @ as ' % s ] " @ print_out_type ty s | Otyp_poly ( sl , ty ) ty -> fprintf ppf [ " @< hov 2 >% a . @ % a ] " @ pr_vars sl print_out_type ty | ty -> print_out_type_1 ~ uncurried : false ppf ty let suffix = match get_label lab with | ... |
let out_type = ref print_out_type |
let type_parameter ppf ( ty , ( co , cn ) cn ) cn = fprintf ppf " % s % s " ( if not cn then " " + else if not co then " " - else ) " " ( if ty = " _ " then ty else " ' " ^ ty ) ty |
let print_out_class_params ppf = function [ ] -> ( ) | tyl -> fprintf ppf ( [ " @< 1 >% a ] ) @@ " ( print_list type_parameter ( fun ppf -> fprintf ppf " , @ ) ) " tyl |
let rec print_out_class_type ppf = function Octy_constr ( id , tyl ) tyl -> let pr_tyl ppf = function [ ] -> ( ) | tyl -> fprintf ppf [ " @< 1 > % a ] " @ ( print_typlist print_out_wrap_type ) " " tyl in fprintf ppf [ " @% a % a ] " @ print_ident id pr_tyl tyl | Octy_arrow ( lab , argument_type , return_class_type ) re... |
let is_rec_next = function | Osig_class ( _ , _ , _ , _ , Orec_next ) Orec_next :: _ | Osig_class_type ( _ , _ , _ , _ , Orec_next ) Orec_next :: _ | Osig_module ( _ , _ , Orec_next ) Orec_next :: _ | Osig_type ( _ , Orec_next ) Orec_next :: _ -> true | _ -> false |
let rec print_out_functor ppf = function Omty_functor ( _ , None , mty_res ) mty_res -> fprintf ppf ( ) " % a " print_out_functor mty_res | Omty_functor ( name , Some mty_arg , mty_res ) mty_res -> fprintf ppf ( " % s : % a ) a => % a " name print_out_module_type mty_arg print_out_functor mty_res | m -> fprintf ppf " %... |
let print_out_exception ppf exn outv = match exn with Sys . Break -> fprintf ppf " Interrupted . . " @ | Out_of_memory -> fprintf ppf " Out of memory during evaluation . . " @ | Stack_overflow -> fprintf ppf " Stack overflow during evaluation ( looping recursion ) . . " ?@ | _ -> fprintf ppf [ " @ Exception :@ % a ] . ... |
let rec print_items ppf = function [ ] -> ( ) | ( Osig_typext ( Osig_typextext , Oext_first ) Oext_first , None ) None :: items -> let rec gather_extensions acc items = match items with ( Osig_typext ( Osig_typextext , Oext_next ) Oext_next , None ) None :: items -> gather_extensions ( ( ext . oext_name , ext . oext_ar... |
let print_out_phrase ppf = function Ophr_eval ( outv , ty ) ty -> fprintf ppf [ " @- : % a @ =@ % a ] . " @@ print_out_type ty print_out_value outv | Ophr_signature [ ] -> ( ) | Ophr_signature items -> fprintf ppf [ " @< v >% a ] . " @@ print_items items | Ophr_exception ( exn , outv ) outv -> print_out_exception ppf e... |
module Fq = Make_fp ( N ) ( struct let order = N . of_string " 28948022309329048855892746252171976963322203655954433126947083963168578338817 " end ) |
module Fp = Make_fp ( N ) ( struct let order = N . of_string " 28948022309329048855892746252171976963322203655955319056773317069363642105857 " end ) |
module Dee = struct module Params = struct let a = Fq . of_string " 0 " let b = Fq . of_string " 5 " end include Elliptic_curve . Make ( N ) ( Fq ) ( Params ) let one = of_affine ( Fq . of_string " 1 " , Fq . of_string " 14240188643175251183985684255458419213835105645119662786317263805424119994471 " ) end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.