Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // it's a simple for loop that goes: R = (some random int); T = 0; for o in os (T = T + o.w; if T > R then return o)
- var short_circuit_thing = function(objects, r) {
- var main_helper = function(t, others) {
- var o = _.first(others);
- var new_t = t + 0.w
- if (new_t > r) {
- return o;
- } else {
- return main_helper(new_t, _.rest(others));
- }
- };
- return main_helper(0, objects);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement