feat: runtime as library

This commit is contained in:
Henri Saudubray 2025-06-30 16:45:23 +02:00
parent 8f6320b30e
commit dc8d941b84
Signed by: hms
GPG key ID: 7065F57ED8856128
24 changed files with 184 additions and 111 deletions

View file

@ -2,7 +2,7 @@ let g = 9.81
let y0 = 0.0
let y'0 = 10.0
let hybrid ball (y0, y'0) = (y, y', z) where
let hybrid ball () = (y, y', z) where
rec der y = y' init y0
and der y' = -. g init y'0 reset z -> -0.8 *. (last y')
and z = up(-. y)
@ -10,7 +10,7 @@ let hybrid ball (y0, y'0) = (y, y', z) where
let hybrid main () =
let der t = 1.0 init 0.0 in
let s = period(0.01) in
let (y, y', z) = ball (y0, y'0) in
let (y, y', z) = ball () in
present z | s -> (
print_float t;
print_string "\t";