http://d.puremagic.com/issues/show_bug.cgi?id=9550
Summary: Repeat!fun(size_t n)
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Daniel Cousens <[email protected]> 2013-02-19 23:45:50
PST ---
Unless I'm missing something, after several separate discussions on the D IRC,
I could not find a way to run a function 'n' times lazily for a range without
doing hackery's like this:
iota(100).map!(x => uniform(0, 76));
The use case is where you want to repeat an (impure) function n times lazily.
A possible example:
auto five_random_ints = take(recurrence!(uniform!int), 5)
or
auto five_random_ints = repeat!(uniform!int)(5);
If there is an idiomatic way to do this already that I am missing, sorry for
taking up your time.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------