Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Created June 12, 2020 15:44
Show Gist options
  • Save gr33n7007h/a0161d6705092bb48a4e7b9ae8124716 to your computer and use it in GitHub Desktop.
Save gr33n7007h/a0161d6705092bb48a4e7b9ae8124716 to your computer and use it in GitHub Desktop.
DOOM
module PythonUtils
refine Array do
def step(from:, to:, step:)
slice(from...to).each_slice(step).map(&:first)
end
end
end
using PythonUtils
p Array(0..75).step(from: 13, to: 45, step: 4) #=> [13, 17, 21, 25, 29, 33, 37, 41]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment