Branch: Tag:

2001-05-19

2001-05-19 10:54:42 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

adding another uniq method (the normal) as uniq2

Rev: lib/modules/Array.pmod:1.51

520:    return mem;    }   } +  + //! Perform uniq on an array, + //! aabbbcaababb -> abcabab +  + array uniq2(array a) + { +  array res; +  mixed last; +  if (!sizeof(a)) return ({}); +  res=({last=a[0]}); +  foreach (a,mixed v) +  if (v!=last) last=v,res+=({v}); +  return res; + }