tag:blogger.com,1999:blog-5569894.post6114898297557055364..comments2023-11-08T13:18:07.006+00:00Comments on Distributed Memory: Generalized IEnumerable to chunked IEnumerable in F#Steve Gilhamhttp://www.blogger.com/profile/03622573187942388226noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5569894.post-52102404582666588882011-04-14T14:55:04.289+01:002011-04-14T14:55:04.289+01:004) Seq.windowed doesn't do what Chunk.Window d...4) Seq.windowed doesn't do what Chunk.Window does. <i>windowed</i> slides a window through the sequence one element at a time (useful for doing moving averages); <i>Window</i> returns the sequence partitioned into disjoint adjacent sections (useful for breaking a file into fixed size pieces to process)<br /><br />Doing this the TDD way, define <i>input</i> as above and go<br /><br />let chunks = input |> Seq.windowed 16 |> Seq.toArray<br />chunks.Length;;<br /><br />get <i>val it : int = 27</i> = 42-16+1 and not the value 3 = (42+16-1)/16Steve Gilhamhttps://www.blogger.com/profile/03622573187942388226noreply@blogger.comtag:blogger.com,1999:blog-5569894.post-2426644768289105112011-04-14T10:24:20.868+01:002011-04-14T10:24:20.868+01:001) What do you think Ratchet and Controlled are do...1) What do you think Ratchet and Controlled are doing?<br /><br />2) If you try that code, you will see that it passes the tests.<br /><br />3) As I said earlier, "I may have missed these in F#"Steve Gilhamhttps://www.blogger.com/profile/03622573187942388226noreply@blogger.comtag:blogger.com,1999:blog-5569894.post-39968432270366283792011-04-13T18:10:50.169+01:002011-04-13T18:10:50.169+01:00Two version and still the wrong code... Repeatedly...Two version and still the wrong code... Repeatedly calling Seq.truncate (or Enumerable.Take) will yield always the same elements. Btw, what about Seq.windowed?Mark Rockmannhttps://www.blogger.com/profile/03694132781184280813noreply@blogger.com