News for hackers. Stuff that matters.
Re:The computers are fast, but you don't know it by 369548684892826 on Thursday June 16, 2022 @06:25PM (#31771757)
> LINQ, to generate only every 4th number in a range

Maybe something like this?

    Enumerable.Range(0,49).Select(x => 4*x + 1)
Re:The computers are fast, but you don't know it by Jtsummers on Thursday June 16, 2022 @06:31PM (#31771801)
Yeah, that would work, throw it before the Where clause and change 49. Range here doesn't specify a stopping point, but a count of generated values (this makes it not quite the same as Python's range). So you'd want:

  Enumerable.Range(0,13).Select(x => 4 * x + 1).Where((e, i) => i % 3 == 0).Skip(2)
And that's equivalent to the original, short of writing a MyRange that combines the first Range and Select. Still an awful lot of work for generating 3 numbers.