From: SonOfLilit Date: 2007-02-20T06:56:12+09:00 Subject: Re: The peak of the iceberg, was Range cannot loop down and RCR Integer#pred Well, perhaps we both didn't understand each other :-) I'll try to be clearer and also understand your points better. On 2/19/07, Robert Dober wrote: > On 2/19/07, SonOfLilit wrote: > > -1 > > First I want to say that I do not mind hijacking threads at all so be > me guest ;) > But I have not talked about the things you are talking here. > > > > Though I can understand why it looks like an iceberg, I think it's one > > of those programmer icebergs that we invent to complete sets. > The iceberg is somewhere else but I do not want to talk about it yet. > > > > Why? > > > > #succ is for #each . > > > > #each is truly essential, as it gives totally new functonality. > > > > #pred would be for a "different order of each". > No sir, your interpretation, I do not advocate a different order of > each I am only talking about #pred. > Have you found useful uses of #pred in a general case (not just for Integer) that is not essentially built on iteration? If so, I apologize. I couldn't find any clue to the existence of such from your post. Would you please elaborate? > It was just when I wanted for demonstration purpose implement a > generic reverse_each that I realized that I was missing #pred in a > more general way. > What is this more general way? > > Now, yes, I do know > > that there /is/ some use for reverse-each, but there are MANY OTHER > > different order-eaches that are as important. That's why > > #to_a.reverse.each is for those cases, that aren't so abundant as to > > /need/ a #reverse_each . > > > > If a fast reverse_each is needed, it's usually about numbers and then > > you have Numeric#step . > > > > > > Perhaps there would be use for this as a library, MAYBE even a > > standard library, but I wouldn't throw this in core Ruby. > What I am talking about *is* already in the core for Integer and I am > drying to apply the same logic to other #succ receivers. > > I really feel very bad not having given enough thought to the RCR. > > > > reverse_each isn't more useful than any other case of sorted_each. > That could be argued but is completely OT. What I meant is that any use case of #pred I could find is a use case that I would attribute to "traverse the range in an arbitrary order". Not because it is more general, just because it fits the thought template of it. It "feels" like a particular case of aforementioned abstraction, and not like a particular abstraction. > > > > Hmm, maybe we should implement that (no ue really, it's so slow it's > > better left out of the path of least resistance.) > > > > > Again you'r making valid and reasonable points, no problem with that, > but they are not related to what I wanted to say. Well I feel at > least. > What use cases for #pred did you find that you were missing? > Robert > -- > We have not succeeded in answering all of our questions. > In fact, in some ways, we are more confused than ever. > But we feel we are confused on a higher level and about more important things. > -Anonymous > >