List Info

Thread: Re: next(n), succ(n) ?




Re: next(n), succ(n) ?
country flaguser name
United States
2008-03-14 14:26:22
Hello,
 That form for Integer is not good as it is not consistent
with the form
for String. Test with n = {-10, 0, 10}. Good day.

Yemi Bedu

P&R Fasteners, Inc.
P&R Castings, LLC.
325 Pierce St
Somerset, NJ 08873
(T) 732-302-3600
(F) 732-302-3636

-----Original Message-----
From: Trans [mailto:transfiregmail.com] 
Sent: Friday, March 14, 2008 12:26 PM
To: ruby-coreruby-lang.org
Subject: Re: next(n), succ(n) ?


On Mar 4, 8:47 am, Trans <transf...gmail.com> wrote:
> Can anyone see any reason against adding an optional
parameter to
> #succ/#next? Eg.
>
>   def succ(n=1)
>     s = self
>     n.times { s = s.next }
>     s
>   end
>
> It might be useful in some cases as an optimization.
For instance in
> Integer:
>
>   def succ(n=1)
>     self + n
>   end
>
> I ask not just a possible suggestion for Ruby itself,
but mainly b/c
> it's one of the few core overrides I provide in Facets,
and I want to
> make sure that there isn't some substantial issue with
the idea that
> should convince me to take it out.

No one has any thoughts on this whatsoever?

T.



[1]

about | contact  Other archives ( Real Estate discussion Medical topics )