Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COIt's generally best to avoid recursive iterator blocks, where possible. Traditional methods have a fairly small overhead each time a method is called, but iterator blocks (as well as `async` methods) have a much greater overhead for the "plumbing" that is set up to make the state machine work. A recursive function such as this is adding a lot of extra overhead creating all of those extra state machines and yielding each of the nested values all the way up to the top. There's also not any real benefit to using this over an iterative approach. Oh, and you iterate `collection` multiple times.
      singulars
    2. COI disagree; recursive iterator blocks are not a bad design flavor. F# for example has even syntax for flattening recursive iterator blocks, which here is achieved by means of a `foreach`. And about over head, obviously one should go with one or another implementation based on her/his priorities; performance? fast development? In this question it is mentioned that there are only 96 items. I am not sure I am suggesting the proper solution but it can be proper if (for example) performance is not a concern here. If performance was the main concern in software development then Ruby would not exist.
      singulars
    3. CO@KavehShahbazian: That still leaves the problem that `collection` is iterated multiple times. In that case, your method shouldn't take an `IEnumerable<T>` but something like `ICollection<T>` or similar.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload