2 deleted 73 characters in body edited Oct 9 '12 at 1:17 rm -rf♦ 82.1k1919 gold badges257257 silver badges416416 bronze badges I would suggest a simple solution based on replacement rules combined with Reap/Sow.: fillGaps[list_] := With[{rules = (Rule @@@ list) ~Join~ {_List -> 0}}, {First@list} ~Join~ (Last@Reap@NestWhile[NestWhileList[ Composition[(Sow[{#, # /. rules}]; #) &, DatePlus[#, 1] &]&,  First],   list[[1, 1]]First@list, #First@# =!= list[[-1, 1]] &&] ] ~Flatten~ 1) ] fillGaps[dateList] (* {{{2012, 1, 1}, 1}, {{2012, 1, 2}, 2}, {{2012, 1, 3}, 0}, {{2012, 1, 4}, 0}, {{2012, 1, 5}, 3}, {{2012, 1, 6}, 0}, {{2012, 1, 7}, 0}, {{2012, 1, 8}, 4}} *)  I would suggest a simple solution based on replacement rules combined with Reap/Sow. fillGaps[list_] := With[{rules = (Rule @@@ list) ~Join~ {_List -> 0}}, {First@list} ~Join~ (Last@Reap@NestWhile[ Composition[(Sow[{#, # /. rules}]; #) &, DatePlus[#, 1] &],   list[[1, 1]], # =!= list[[-1, 1]] & ] ~Flatten~ 1) ] fillGaps[dateList] (* {{{2012, 1, 1}, 1}, {{2012, 1, 2}, 2}, {{2012, 1, 3}, 0}, {{2012, 1, 4}, 0}, {{2012, 1, 5}, 3}, {{2012, 1, 6}, 0}, {{2012, 1, 7}, 0}, {{2012, 1, 8}, 4}} *)  I would suggest a simple solution based on replacement rules: fillGaps[list_] := With[{rules = (Rule @@@ list) ~Join~ {_List -> 0}}, NestWhileList[ Composition[{#, # /. rules} &, DatePlus[#, 1] &, First],   First@list, First@# =!= list[[-1, 1]] &] ] fillGaps[dateList] (* {{{2012, 1, 1}, 1}, {{2012, 1, 2}, 2}, {{2012, 1, 3}, 0}, {{2012, 1, 4}, 0}, {{2012, 1, 5}, 3}, {{2012, 1, 6}, 0}, {{2012, 1, 7}, 0}, {{2012, 1, 8}, 4}} *)  1 answered Oct 9 '12 at 0:29 rm -rf♦ 82.1k1919 gold badges257257 silver badges416416 bronze badges I would suggest a simple solution based on replacement rules combined with Reap/Sow. fillGaps[list_] := With[{rules = (Rule @@@ list) ~Join~ {_List -> 0}}, {First@list} ~Join~ (Last@Reap@NestWhile[ Composition[(Sow[{#, # /. rules}]; #) &, DatePlus[#, 1] &], list[[1, 1]], # =!= list[[-1, 1]] & ] ~Flatten~ 1) ] fillGaps[dateList] (* {{{2012, 1, 1}, 1}, {{2012, 1, 2}, 2}, {{2012, 1, 3}, 0}, {{2012, 1, 4}, 0}, {{2012, 1, 5}, 3}, {{2012, 1, 6}, 0}, {{2012, 1, 7}, 0}, {{2012, 1, 8}, 4}} *)