--- Robert Klemme <bob.news / gmx.net> wrote: > > [nil, "aa", "bb"] > > ["aa", "bb", "cc"] > > ["bb", "cc", "dd"] > > ["cc", "dd", "ee"] > > ["dd", "ee", "ff"] > > ["ee", "ff", "gg"] > > ["ff", "gg", "hh"] > > ["gg", "hh", "ii"] > > ["hh", "ii", "jj"] > > ["ii", "jj", "kk"] > > ["jj", "kk", nil] > > Well, it depends. If, for example, you would want > to make a plot that > used averaged values (i.e. to smooth the curve) you > would not want to see > those lines containing nil values IMHO. It seems like it depends on the application then. Most of the ones I can visualize involve processing each item in order, with the previous and next values used for something if they're available, but items still need to be processed if there isn't a previous or next. > > Admittedly, it'd be hard to that reasonably with a > > variable-size window of even length. But for a > > previous-current-next arrangement, it seems to > make > > more sense to say "there is no previous" with a > nil > > than to basically skip the first item. > > It's not that hard to do. Hmmm, maybe I should say "It's hard to decide what the output should look like. As in, for someone who wants those nils like I do, should the first set of arguments from each_window(4) be something like [nil, "aa", "bb", "cc"] or [nil, nil, "aa", "bb"] ? It's obvious with odd length windows, the current item should always be the middle one. And with the kind that doesn't use nils, defining one item as the current one probably isn't meaningful anyway, so it's not an issue. -Morgan __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com