Branch: Tag:

2003-04-28

2003-04-28 14:36:59 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Array.flatten() of cyclic datastructures is now more deterministic.

Rev: lib/modules/Array.pmod:1.84

549:    if (state && state[a]) return state[a];    if (!state) state = ([a:({})]);    else state[a] = ({}); -  foreach(a, mixed b) state[a]+=arrayp(b)?flatten([array]b, state):({b}); -  return state[a]; +  array res = allocate(sizeof(a)); +  foreach(a; int i; mixed b) { +  res[i] = arrayp(b)?flatten([array]b, state):({b});    } -  +  return state[a] = (res*({})); + }      //! Sum the elements of an array using `+   mixed sum(array a)