On Sat, 2011-03-12 at 09:33 +0000, Russel Winder wrote: [ . . . ] > 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.
Sorry I needed to add the driver code: foreach ( item ; data ) { assert ( declarative ( item[0] ) == item[1] ) ; } within a unittest block. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part