Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created March 24, 2012 15:03
Show Gist options
  • Save nikomatsakis/2183994 to your computer and use it in GitHub Desktop.
Save nikomatsakis/2183994 to your computer and use it in GitHub Desktop.
fn with<T,R>(v: T, f: f(T) -> R) -> R {
f(v)
}
fn some_func(a: uint, b: uint) -> uint {
with(
fn&(x: uint) -> uint { a + b + x }
) {|helper|
helper(22)
}
}
fn some_func(a: uint, b: uint) -> uint {
let helper = fn@(x: uint) -> uint {
a + b + x
};
helper(22)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment