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
import numpy.random as nprnd | |
from time import clock | |
def r_step_generator(lo, hi): | |
num = lo | |
diff = hi - lo | |
while True: | |
num += nprnd.randint(0, diff) | |
if num < hi: | |
yield num |
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
fn main() { | |
#[deriving(Show)] | |
struct Foo { | |
a: i32 | |
} | |
let mut test:Vec<Foo> = Vec::new(); | |
test.push(Foo { a: 1 }); | |
test.push(Foo { a: 3 }); | |
test.push(Foo { a: 2 }); |
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
function all(promises) { | |
return promises.reduce(function (previous, next) { | |
return join(previous, next, function ([previous_results, next_val]) { | |
previous_results.push(next_val); | |
return previous_results; | |
}); | |
}, Promise.resolve([])); | |
} | |
function join(x, y) { |