lib/generators.rb
# Euclidean generators (Spread to integers)
Euclidean generators (Spread to integers)
Euclidean generators ( Spread to integers )
def bools_to_seq(arr)
    last = 0
    l = arr.each_with_index.inject([]) do |a,(j,i)|
      if j
        a.push(1)
        last+=1 if i>0
      else
        a[last]+=1
      end
      a
    end
    l
  end
def bools_to_seq ( arr ) last = 0 l = arr . each_with_index . inject ( [ ] ) do | a , ( j , i ) | if j a . push ( 1 ) last += 1 if i > 0 else a [ last ] += 1 end a end l end
Euclidean generators (Spread to integers)
Euclidean generators ( Spread to integers )
arr