xsl-list
[Top] [All Lists]

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

2007-01-31 12:07:33
Michael Kay wrote:
Not sure why you are using index-of (or some, for that matter). It looks to
me like

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

Aha! (erlebnis)
Thanks, Michael. It was one of those problems I can look at forever without 'seeing' the inverse-logic algorithm you present me here. Instead of going through the objects and 'satisfying' from each object (hence trying index-of to find near-by objects), I should've used a simple range operator and indices instead.

This definitely clears up my mind for several lock-up problems (and I shouldn't stay up too late ;)

(or some, for that matter)
That was a typo, the example problem only works, of course, with 'every', I have some other cases where 'some' is required.


Cheers!
-- Abel



--~------------------------------------------------------------------
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>
--~--