enumerator Questions

10

Solved

Context: C# 3.0, .Net 3.5 Suppose I have a method that generates random numbers (forever): private static IEnumerable<int> RandomNumberGenerator() { while (true) yield return GenerateRando...
Equalizer asked 19/8, 2010 at 17:22

1

Solved

As per Ruby's documentation, the Enumerator object uses the each method (to enumerate) if no target method is provided to the to_enum or enum_for methods. Now, let's take the following monkey patch...
Samba asked 15/6, 2012 at 19:45

6

Solved

I''m curious about why ruby returns an Enumerator instead of an Array for something that seems like Array is an obvious choice. For example: 'foo'.class # => String Most people think of a Str...
Saphena asked 9/5, 2012 at 12:4

2

Solved

So the Play2.0 Enumeratee page shows an example of using a the &> or through method to change an Enumerator[String] into an Enumerator[Int]: val toInt: Enumeratee[String,Int] = Enumeratee.m...
Thetos asked 27/4, 2012 at 7:34

1

Solved

I want to use the enumerator for a generic collection with Delphi XE2. I am wondering, who owns the TEnumerator returned by the function GetEnumerator (I haven't found any clear answer in the docum...
Condole asked 15/3, 2012 at 11:15

3

Solved

I'm using the extension menthod Reverse(), but it does not seem to be doing anything. The MSDN states it is implemented as a deferred execution, however I can't seem to get this to work. Here is h...
Rima asked 11/3, 2012 at 23:55

2

Solved

From what I've read, a design decision was made for certain Collections's Enumerator Types to be mutable structs instead of reference types for performance reasons. List.Enumerator is the most well...
Matland asked 7/2, 2012 at 21:7

3

Solved

Can somebody give me advice on how to create a recursive version of GetEnumerator()? The well-known Towers of Hanoi problem may serve as an example that is comparable to the actual problem I have....
Childish asked 11/1, 2012 at 15:24

3

Solved

I was looking up the difference between the two classes and this point came up in a lot of the answers with this blog being the source: http://javarevisited.blogspot.com/2010/10/difference-between...
Precast asked 5/1, 2012 at 22:43

1

Solved

Disclaimer: this was asked recently on the haskell-cafe list. My apologies to anyone bothered by the double post. All of the iteratee-implementing packages that I know of (e.g. iteratee, iterIO, a...
Touber asked 29/12, 2011 at 23:41

2

Solved

I have an attributes array as follows, attributes = ["test, 2011", "photo", "198.1 x 198.1 cm", "Photo: Manu PK Full Screen"] When i do this, artist = attributes[-1].gsub("Photo:") p artist ...
Asceticism asked 13/12, 2011 at 6:52

2

For example: a = [1,2,3,4,5] a.delete_if { |x| x > 3 } is equivalent to: a = [1,2,3,4,5] a.delete_if.each.each.each.each { |x| x > 3 } I know a.delete_if returns an enumerator. But how ...
Albanian asked 7/10, 2011 at 19:34

1

Solved

Currently, there two popular choices which implement the iteratee pattern: The enumerator package and the iteratee package. What are their relative benefits? Is one better than the other, or d...
Condon asked 6/10, 2011 at 13:2

3

Solved

I'm having teething problems with Ruby, with regards to creating single-direction, lazily-evaluated, potentially-infinite iterators. Basically, I'm trying to use Ruby like I'd use Haskell lists and...
Sinless asked 8/8, 2011 at 1:50

2

Solved

I've written a function similar to Data.Enumerator.List.map that makes an Iteratee compatible with an Enumerator that feeds a different Stream type. import Data.Enumerator test :: Monad m => ...
Christianly asked 3/8, 2011 at 15:19

1

Solved

Earlier today I wrote a small test app for iteratees that composed an iteratee for writing progress with an iteratee for actually copying data. I wound up with values like these: -- NOTE: this sni...
Codeclination asked 14/7, 2011 at 5:39

5

Solved

I've got two long streams of numbers coming from two different sources (binary data) in Ruby (1.9.2). The two sources are encapsulated in the form of two Enumerators. I want to check that the two...
Fasciate asked 26/6, 2011 at 19:10

2

Solved

I have defined a collection derived from TDictionary, and need to define a custom enumerator that apply an additional filter. I'm stuck as I can't access the TDictionary FItems array (it is privat...
Fucus asked 18/5, 2011 at 11:57

3

Solved

How can i list all the names (and values) of public (and private / protected) const defined in a class ? public class Layers { public const BACKGROUND:String = "background"; public const PARENT...
Freak asked 6/10, 2010 at 10:32

3

Solved

In C#, what's the most elegant way to create an array of objects, from an enumerator of objects? e.g. in this case I have an enumerator that can return byte's, so I want to convert this to byte[]. ...
Migration asked 21/8, 2010 at 12:39

1

Solved

I'm trying to log the contents of the HttpServletRequest attributes collection. I need to do this when the servlet first starts, and again right before the servlet is finished. I'm doing this in an...
Margerymarget asked 20/8, 2010 at 16:47

2

Solved

Iterating a block in Ruby is simple enough - it finishes cleanly and proceeds on to the rest of the code. Iterating with an Enumerator, on the other hand, is a bit more confusing. If you call :ea...
Napper asked 9/7, 2010 at 12:27

5

Solved

Using Delphi 2010, let's say I've got a class declared like this: TMyList = TList<TMyObject> For this list Delphi kindly provides us with an enumerator, so we can write this: var L:TMyLis...
Bly asked 5/7, 2010 at 7:28

2

Solved

What is the best way to convert a non-generic collection to a generic collection? Is there a way to LINQ it? I have the following code. public class NonGenericCollection:CollectionBase { public ...
Stinko asked 8/4, 2009 at 21:4

6

Solved

I have two arrays built while parsing a text file. The first contains the column names, the second contains the values from the current row. I need to iterate over both lists at once to build a map...
Baldwin asked 30/1, 2009 at 18:50

© 2022 - 2024 — McMap. All rights reserved.