Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:39:03 UTC, Jonathan M Davis wrote: Eager is far more general. Also, while the drop* functions are eager, the take* functions are not. I don't recall the precise details of these particular ranges off the top of my head (away from computer so can't easily check), but one nasty little detail of supposedly lazy ranges is that they are often eager for the first element, lazy thereafter -- and even there it's subtly different from 'true' laziness inasmuch as the new values are generated at the point of popping rather than the point of access to the new front. In most cases that's an implementation detail, but it gets _very_ interesting when the elements of your range are non-deterministic.
Re: Categorizing Ranges
On Friday, 9 October 2015 at 16:08:58 UTC, Mike Parker wrote: This is for the "Learning D" book I'm currently doing revisions on. In the chapter on std.range and std.algorithm, there was an imbalance with the latter being neatly categorized into the different modules. It looked odd having the std.range stuff all lumped under one section heading. One of the technical reviewers (rightly) didn't like my initial "Selfish" category, and I agree. I can certainly understand trying to categorize ranges like this, but at the same time, it seems like there's such a range of things - pun intended :) - that they can do that it quickly becomes about as tenable to categorize ranges as it does to categorize _all_ functions, which is pretty questionable IMHO. In general, I don't think I'd even bother trying to categorize them except to the extent required to figure out which package or module to stuff them in (like you have to do with any function), but it can be more important to categorize stuff in a teaching setting. - Jonathan M Davis
Re: Categorizing Ranges
On Friday, 9 October 2015 at 10:01:47 UTC, Per Nordlöw wrote: I'm guessing you're thinking about categorizing the list at http://dlang.org/phobos/std_range.html , right? ;) That would, IMHO, be a nice usability/discoverability improvement, especially for new users! :) This is for the "Learning D" book I'm currently doing revisions on. In the chapter on std.range and std.algorithm, there was an imbalance with the latter being neatly categorized into the different modules. It looked odd having the std.range stuff all lumped under one section heading. One of the technical reviewers (rightly) didn't like my initial "Selfish" category, and I agree.
Re: Categorizing Ranges
On Friday, 9 October 2015 at 10:01:47 UTC, Per Nordlöw wrote: I've Googled a bit on this topic, say: "algorithm visualization" "Software Visualization" seems to be the correct research term.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop I'm guessing you're thinking about categorizing the list at http://dlang.org/phobos/std_range.html , right? ;) That would, IMHO, be a nice usability/discoverability improvement, especially for new users! :) Further, I've thought about adding some kind standardized graphical explanation for the ranges and algorithms in Phobos. I've Googled a bit on this topic, say: "algorithm visualization" but I can't seem to find any concrete work on this topic. Refs ideas anyone? What file format would be preferred for such graphical descriptions? I'm guessing SVG would be a good contender. A supercool thing would be if we, with the help of D's marvellous meta-programming and CT/RT-reflection, could auto-generate these visualizations.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 18:26:29 UTC, qznc wrote: Selective Although, then stride fits better into Selective than into Iterative. On the other hand, iterative seems not that fitting to me. lockstep might also be Compositional. I actually agree with you about iterative, but I hadn't considered changing it until I read this. IIRC, I picked the name based on the documentation. All three of the listed ranges use "Iterates" in the short description. I also included zip in that category because it's akin to lockstep, despite the intuition that it should be considered compositional. Anyway, I'm not looking to establish any conventions here, just an easy way to describe ranges. This thread has helped a good deal.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: What to put into the XXX? Thanks for the brainstorming session everyone. I'm on a deadline so I need to pick something and go with it. This thread has simplified things for me.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. Selective Although, then stride fits better into Selective than into Iterative. On the other hand, iterative seems not that fitting to me. lockstep might also be Compositional.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. If it were just take, then maybe "bounding" would work, and I guess that _technically_ that works with drop as well, but it seems kind of off to talk about bounding when the bounds are everything _but_ a small number of elements. - Jonathan M Davis
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 18:09:51 UTC, Meta wrote: On Wednesday, 7 October 2015 at 17:15:47 UTC, Jonathan M Davis wrote: Except that take doesn't mutate its function argument, and drop only does if the range is a reference type. So, they really aren't mutating algorithms. - Jonathan M Davis Yeah, true. Partitioning or Isolating, something along those lines seems more descriptive I guess, as that's technically what you're doing. Needy
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 17:15:47 UTC, Jonathan M Davis wrote: Except that take doesn't mutate its function argument, and drop only does if the range is a reference type. So, they really aren't mutating algorithms. - Jonathan M Davis Yeah, true. Partitioning or Isolating, something along those lines seems more descriptive I guess, as that's technically what you're doing.
Re: Categorizing Ranges
On 10/07/2015 09:15 AM, Mike Parker wrote: On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: Something like shortening, minimizing? Ali How about reductive? That's what I had in mind when I started thesaurusing for the other two. :) Ali
Re: Categorizing Ranges
On Wed, Oct 07, 2015 at 05:15:45PM +, Jonathan M Davis via Digitalmars-d wrote: > On Wednesday, 7 October 2015 at 16:54:00 UTC, Meta wrote: > >On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: > >>I'm looking for ideas on how to label the ranges returned from take > >>and drop. Some examples of what I think are appropriate categories > >>for other types of ranges: > >> > >>Generative - iota, recurrence, sequence > >>Compositional - chain, roundRobin, transposed > >>Iterative - retro, stride, lockstep > >>XXX - take, drop > >> > >>What to put into the XXX? I first thought of "Greedy", but that has > >>an association with "greedy algorithms" that I don't really like. > >>That led to "Selfish", but it's admittedly not that appropriate. > >>Beyond that, I'm stuck. Any and all ideas appreciated. > > > >Mutating. > > Except that take doesn't mutate its function argument, and drop only > does if the range is a reference type. So, they really aren't mutating > algorithms. [...] Sub-ranging? T -- A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and, more important, to tasks that have not yet been conceived. -- Michael B. Allen
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 16:54:00 UTC, Meta wrote: On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. Mutating. Except that take doesn't mutate its function argument, and drop only does if the range is a reference type. So, they really aren't mutating algorithms. - Jonathan M Davis
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. Mutating.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 16:15:13 UTC, Mike Parker wrote: On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: Something like shortening, minimizing? Ali How about reductive? subtractive
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: Something like shortening, minimizing? Ali How about reductive?
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:46:00 UTC, Andrea Fontana wrote: On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: On 10/07/2015 08:06 AM, Mike Parker wrote: Something like shortening, minimizing? Slicing? Partitioning?
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:46:00 UTC, Andrea Fontana wrote: On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: On 10/07/2015 08:06 AM, Mike Parker wrote: Something like shortening, minimizing? Ali Slicing? Similar, but that's already a pretty overloaded term, and neither take nor drop requires that a range support slicing. - Jonathan M Daivs
Re: Categorizing Ranges
On 10/07/2015 08:06 AM, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. Something like shortening, minimizing? Ali
Re: Categorizing Ranges
On 07.10.2015 18:06, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. Specifying?
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:43:44 UTC, Ali Çehreli wrote: On 10/07/2015 08:06 AM, Mike Parker wrote: Something like shortening, minimizing? Ali Slicing?
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:13:17 UTC, Big Daddy wrote: On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. eager Eager is far more general. Also, while the drop* functions are eager, the take* functions are not. - Jonathan M Davis
Categorizing Ranges
I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated.
Re: Categorizing Ranges
On Wednesday, 7 October 2015 at 15:06:55 UTC, Mike Parker wrote: I'm looking for ideas on how to label the ranges returned from take and drop. Some examples of what I think are appropriate categories for other types of ranges: Generative - iota, recurrence, sequence Compositional - chain, roundRobin, transposed Iterative - retro, stride, lockstep XXX - take, drop What to put into the XXX? I first thought of "Greedy", but that has an association with "greedy algorithms" that I don't really like. That led to "Selfish", but it's admittedly not that appropriate. Beyond that, I'm stuck. Any and all ideas appreciated. eager