From: John M. S. <sk...@oz...> - 2003-06-16 19:38:25
|
Brian Hurt wrote: > On Sat, 14 Jun 2003, John Max Skaller wrote: > > >>i don't want you counting my lists :-) >> > > What is so evil about doing a List.length? Especially in this case, where > I hard cap the computational cost- as all I need to answer is if the > length less than some constant. So, for short lists (for some suitably > wimbly definition of short) doing a list length is cheap. Nothing is cheap inside an inner loop :-) The count could cost as much as a fold, particularly as a count IS in fact a fold. So you might double my computation time, if I have a heavily nested fold on a small list. I may even know the list is always small, and hope the compiler may speed things up by unrolling the fold :-) -- John Max Skaller, mailto:sk...@oz... snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 |