On Fri, 2011-03-11 at 18:46 -0500, Jesse Phillips wrote:
> Without testing: foreach (f; take(recurrence!("a[n-1] + a[n-2]")(0UL, 1UL),
> 50))
>
> teo Wrote:
>
> > Just curious: How can I get ulong here?
> >
> > foreach (f; take(recurrence!("a[n-1] + a[n-2]")(0, 1), 50))
> > {
> > writeln(f);
> > }
>
Interestingly, or not, the code:
long declarative ( immutable long n ) {
return take ( recurrence ! ( "a[n-1] + a[n-2]" ) ( 0L , 1L ) , n ) ;
}
results in the return statement delivering:
rdmd --main -unittest fibonacci_d2.d
fibonacci_d2.d(15): Error: template std.range.take(R) if
(isInputRange!(Unqual!(R)) && !isSafelySlicable!(Unqual!(R)) && !is(Unqual!(R)
T == Take!(T))) does not match any function template declaration
fibonacci_d2.d(15): Error: template std.range.take(R) if
(isInputRange!(Unqual!(R)) && !isSafelySlicable!(Unqual!(R)) && !is(Unqual!(R)
T == Take!(T))) cannot deduce template function from argument types
!()(Recurrence!(fun,long,2u),immutable(long))
which seems deeply impenetrable for mere mortals.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
