Skip to content

Instantly share code, notes, and snippets.

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)
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
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
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 {