Skip to content
View iwahbe's full-sized avatar
🏠
Working from home
🏠
Working from home

Organizations

@pulumi

Block or report iwahbe

Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
iwahbe/README.md

Hello world

  • I'm currently working at Pulumi as a Software Engineer.
  • I'm available on twitter at @iwahbe or at linkedin at the same name.
Anything can be complicated. Let's make the simple things simple.

fn fizzbuzz(n: usize) {
    let factory = move |div_by: usize, then: Box<dyn Fn(usize)>, otherwise: Box<dyn Fn(usize)>| {
        move |k: usize| {
            if k % div_by == 0 {
                then(k)
            } else {
                otherwise(k)
            }
        }
    };
    macro_rules! box_me {
        ($e: expr) => {
            Box::new($e)
        };
    }
    let print_k = box_me!(|k| println!("{:?}", k));
    let buzz_yes = box_me!(factory(
        5,
        box_me!(|_| println!("fizzbuzz")),
        box_me!(|_| println!("fizz")),
    ));
    let buzz_no = box_me!(factory(5, Box::new(|_| println!("buzz")), print_k));
    let fizz = factory(3, buzz_yes, buzz_no);
    (1..n + 1).for_each(fizz)
}

Pinned Loading

  1. jsonian jsonian Public

    Emacs Lisp 90 8

  2. rdma-fs rdma-fs Public

    A file system over RDMA

    Rust 27 1