Skip to content

Instantly share code, notes, and snippets.

@susisu
Last active October 13, 2017 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save susisu/a5efa95ff72f5f3d10489b95c46183cd to your computer and use it in GitHub Desktop.
Save susisu/a5efa95ff72f5f3d10489b95c46183cd to your computer and use it in GitHub Desktop.
function* seq(a, b, delta = 1) {
let num = a;
let correction = 0;
while (num <= b) {
yield num;
const delta_ = delta - correction;
const next = num + delta_;
correction = (next - num) - delta_;
num = next;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment