develooper Front page | perl.perl6.language | Postings from October 2008

Re: [svn:perl6-synopsis] r14586 - doc/trunk/design/syn

Thread Previous | Thread Next
From:
Larry Wall
Date:
October 5, 2008 20:38
Subject:
Re: [svn:perl6-synopsis] r14586 - doc/trunk/design/syn
Message ID:
20081006033747.GA27673@wall.org
On Sun, Oct 05, 2008 at 08:19:42PM -0700, Jon Lang wrote:
: <larry@cvs.perl.org> wrote:
: > Log:
: > Add missing series operator, mostly for readability.
: 
: Is there a way for the continuing function to access its index as well
: as, or instead of, the values of one or more preceding terms?  And/or
: to access elements by counting forward from the start rather than
: backward from the end?

That's what the other message was about.  @_ represents the entire list
generated so far, so you can look at its length or index it from the
begining.  Not guaranteed to be as efficient though.

: There is a mathematical technique whereby any series that takes the
: form of "F(n) = A*F(n-1) + B*F(n-2) + C*F(n-3)" can be reformulated as
: a function of n, A, B, C, F(0), F(1), and F(2).  (And it is not
: limited to three terms; it can be as few as one or as many as n-1 -
: although it has to be the same number for every calculated term in the
: series.)  For the Fibonacci series, it's something like:
: 
: F(n) = (pow((sqrt(5) + 1)/2, n) + pow((sqrt(5) - 1)/2, n))/sqrt(5)
: 
: ...or something to that effect.  It would be nice if the programmer
: were given the tools to do this sort of thing explicitly instead of
: having to rely on the optimizer to know how to do this implicitly.

Um, I don't understand what you're asking for.  Explicit solutions
are always available...

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About