Re: [racket-users] Iterating through a list more than one at a time

2016-08-11 Thread Greg Hendershott
Yes. Also each slice is a sequence. So you could do all the usual things to it. Including but not limited to using another `for` form, applying it to afunction, or destructuring it using `match` and friends. In these examples I included an extra, "leftover" element to make sure it was handled:

Re: [racket-users] Iterating through a list more than one at a time

2016-08-10 Thread David Storrs
On Wed, Aug 10, 2016 at 5:50 AM, Greg Hendershott wrote: > > I feel like there should be a simpler way to do this, but I haven't found > > one despite much Googling and reading of docs about "for" and its > siblings. > > Can someone point me the right way? > > > > I'd like to be able to iterate o

Re: [racket-users] Iterating through a list more than one at a time

2016-08-10 Thread Greg Hendershott
> I feel like there should be a simpler way to do this, but I haven't found > one despite much Googling and reading of docs about "for" and its siblings. > Can someone point me the right way? > > I'd like to be able to iterate over a list N elements at a time -- e.g., > grab elements 1 and 2, do so

Re: [racket-users] Iterating through a list more than one at a time

2016-08-04 Thread David Storrs
Great, thank you. I was thinking maybe there was some construct that could do this built-in, the way 'map' can double as 'zip'. I looked through sugar and it looks very convenient; I'll be using it in future. Note that when I installed it, I got the following: [...snip lots of "raco setup: 0 sk

Re: [racket-users] Iterating through a list more than one at a time

2016-08-04 Thread Matthew Butterick
On Aug 4, 2016, at 3:10 PM, David Storrs wrote: > I'd like to be able to iterate over a list N elements at a time -- e.g., grab > elements 1 and 2, do something with them, grab 3 and 4, etc. Your technique seems fine. You could use `split-at` if you wanted to save a list operation, otherwise i