xsl-list
[Top] [All Lists]

Re: [xsl] Use pure XPath to test a sequence for being a valid Fibonacci sequence

2007-01-31 15:34:59
Abel Braaksma wrote:

  Hi

Abel Braaksma wrote:

Michael Kay wrote:

$fib[1] = 0 and $fib[2] = 1 and
  every $i in 2 to count($fib) satisfies
    $fib[$i] = $fib[$i - 1] + $fib[$i - 2]

Here's another version, which eases the expression a bit
by removing the special cases:

every $i in 1 to count($fib) satisfies
       $fib[$i] = (0, $fib)[$i] + (0, 1, $fib)[$i]

  Personally, I like the first version.  The second one is
shorter, but the first one as is almost a literal
translation from the mathematical definition.  But it is a
matter of taste, I guess.

  Regards,

--drkm



















        

        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
http://fr.answers.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--