~myClump = { |array, thr = 0.1| var a = array.copy.sort, colcol, col; a.do { |x, i| ((i > 0) and: { x - col[0] > thr }).if { colcol = colcol.add(col); col = [x] }{ col = col.add(x) }; (a.size - 1 == i).if { colcol = colcol.add(col) } }; colcol } ~myClump.([0, 0.1, 0.2, 0.3, 0.4, 0.41, 0.42, 0.43, 0.5, 0.6], 0.25) ~myClump.([0, 0.1], 0.25) ~myClump.([0], 0.25) ~myClump.([0, 0.3], 0.25) Greetings Daniel ----------------------------- http://daniel-mayer.at ----------------------------- |