[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] Re: [sc-users] array shortcut problem



(
	// two ways of notation, the results are equal:
var a, b;
a = (0, 0.05 .. 1);
b = Array.fill(21, { |i| i * 0.05 });
a.dump;
b.dump;
a == b; // true
)

	// BUT:

	// last printed value is 0.95, not 1, hmmm
(0, 0.05 .. 1).do { |each| each.postln }; "";

	// whereas this prints what I expect:
Array.fill(21, { |i| i * 0.05 }).do { |each| each.postln }; "";




Any ideas? Thanks.
Stephan

(0, 0.05 .. 1).do ..

is optimised so that there needs no array to be built.
there must be a bug somewhere in this code.
--





.