Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (16 sloc) 424 Bytes
class Array
def date_sorted
sort { |left,right| left.date <=> right.date }
end
def transitions
each_cons(2).to_a
end
def freq
groups = group_by { |value| value }
(0..(max || -1)).map { |bin| groups.fetch(bin, []).count }
end
def convolve filter_function
window_size = method(filter_function).arity
each_cons(window_size).map { |window| send(filter_function, *window) }
end
end
Jump to Line
Something went wrong with that request. Please try again.