digitalmars.D.bugs - [Issue 2928] New: Swap order of paramaters for std.range's "take"
- d-bugmail puremagic.com (17/17) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (4/4) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (5/5) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (12/15) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (10/10) Oct 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (24/24) Dec 08 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (12/12) Jan 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (6/6) Jan 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2928
- d-bugmail puremagic.com (12/12) May 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2928
http://d.puremagic.com/issues/show_bug.cgi?id=2928
Summary: Swap order of paramaters for std.range's "take"
Product: D
Version: 2.029
Platform: PC
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: bugzilla digitalmars.com
ReportedBy: cbkbbejeap mailinator.com
According to the docs, in std.range, "take" takes the range as its second
parameter and 'n' as the first parameter. This ordering should be swapped, 1.
to be consistent with stride, advance, retreatN, and cycle, and 2. to allow the
syntax "a.take(n)" like with advance.
--
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2928 Undecided. take is inspired from Haskell et al where the range comes last. --
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2928 Keep in mind that Haskell's parameter ordering is based on partial application, a feature that D obviously does not have. --
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2928Keep in mind that Haskell's parameter ordering is based on partial application, a feature that D obviously does not have.Sort of does: import std.functional, std.range, std.stdio; void main() { auto a = [ 1, 2, 3 ][]; alias curry!(take, 2) take2; foreach (e; take2(a)) { writeln(e); } } But I agree there are good arguments in favor of swapping arguments. --
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2928
Andrei Alexandrescu <andrei metalanguage.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |andrei metalanguage.com
AssignedTo|nobody puremagic.com |andrei metalanguage.com
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2928
Lutger <lutger.blijdestijn gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lutger.blijdestijn gmail.co
| |m
PST ---
Please consider this also for replicate* and any other functions (though
replicate and take are the only ones I could find.)
Note that in haskell's prelude, there are many functions that also can be found
in phobos, such as splitAt and until, for which the same argument could be
made. Haskell does seem to be more consistent in argument ordering, always the
predicate first and then the list, this makes it easy to remember.
It's a bit weird that when uniform function call syntax will be implemented,
this will work:
iota(0,10).stride(2).until(8)
but this won't work:
iota(0,10).stride(2).take(4)
I'd rather give up currying myself to make this work, even for the benefit of
consistency alone.
* note that std.string.repeat is defined as string repeat(string s, size_t n);
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2928
Kyle Foley <k-foley onu.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |k-foley onu.edu
What is the status on this? I would like to see it it changed to
Take!(R) take(R)(R input, size_t n);
Take!(Repeat!(T)) replicate(T)(T value, size_t n);
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2928 17:16:25 PST --- I'll change that soon. Thanks! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2928
Kyle Foley <k-foley onu.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Fixed in 2.041
http://digitalmars.com/d/2.0/changelog.html#new2_041
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2010









d-bugmail puremagic.com 