On Wed, Jan 21, 2009 at 07:14:10AM +0100, Petr Rockai wrote: > Eric Kow <[email protected]> writes: > > Refactor add_to_list. > > --------------------- > >> +-- | Add element @x@ to list @xs@ if it isn't there yet. > >> add_to_list :: Eq a => a -> [a] -> [a] > >> hunk ./src/Darcs/Repository/Prefs.lhs 382 > >> -add_to_list s [] = [s] > >> -add_to_list s (s':ss) = if s == s' then (s:ss) else s': add_to_list s ss > >> +add_to_list x xs = if x `elem` xs then xs else x : xs > > > > Does it matter that x is now added to the front of the list instead of > > to the back? (I guess we could do xs ++ [x] if it does indeed matter) > The net effect of the ordering change is that when you pull from a completely > new repository, it will be added as a first item to _darcs/prefs/repos instead > of last. The function doesn't seem to be used for _darcs/prefs/sources, where > ordering *does* matter (*but* current darcs gets it wrong anyway, so...).
Thanks, Petr. Do you think this patch should be applied as-is, or should I amend it to avoid the reversal? _______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
