This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod exception_handling { | |
pub trait Exception<B> { | |
fn raise<A, K>(self, v: (), k: K) -> B | |
where | |
K: FnOnce(A) -> B; | |
} | |
pub struct ExceptionDiv {} | |
impl Exception<()> for ExceptionDiv { | |
fn raise<A, K>(self, _: (), _: K) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod reset { | |
pub trait Reset<C> { | |
fn reset<B, K>(self, shift: impl FnOnce(K) -> C, k: K) -> C | |
where | |
K: FnOnce(B) -> C; | |
} | |
pub struct CallBack {} | |
impl<C> Reset<C> for CallBack { | |
fn reset<B, K>(self, shift: impl FnOnce(K) -> C, k: K) -> C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod async_await { | |
use std::sync::mpsc::channel; | |
use std::sync::mpsc::Receiver; | |
use std::thread; | |
use std::time::Duration; | |
pub trait AsyncAwait<B, C> { | |
type Promise<X>; | |
fn asynchronous<K>(self, asynchronous_b: fn() -> B, k: K) -> C | |
where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod probabilistic_programming { | |
pub mod print_helpers { | |
pub fn print_bool_distribution(vec: Vec<(f64, bool)>) { | |
let mut trues = 0.0; | |
let mut falses = 0.0; | |
for (weight, outcome) in vec { | |
if outcome { | |
trues += weight; | |
} else { |