[vector] #15: Add "generalised scan"

vector vector at projects.haskell.org
Fri Jun 11 17:40:35 EDT 2010


#15: Add "generalised scan"
------------------------+---------------------------------------------------
Reporter:  rl           |        Owner:     
    Type:  enhancement  |       Status:  new
Priority:  critical     |    Milestone:  0.7
 Version:  0.6          |   Resolution:     
Keywords:               |  
------------------------+---------------------------------------------------
Comment (by choener):

 {{{
 cant_think_of_a_name :: Vector v a => Int -> (v a -> Int -> a) -> v a
 }}}

 This is actually how it should be. The function needs the current vector
 and the index where we  are at. If you tell me, that in terms of speed
 there will be no difference because I can just query the length, that's
 ok. too. ;-)

 I can't decide if the function (eg f below) is supposed to be a small
 kernel that would typically be only a few lines of assembly, or if it is
 more like half a program. Guessing from my code, both will be true.

 Example
 {{{
 cant_think_of_a_name 100 f

 f v k
   | k == 0    = 1
   | k == 1    = 1
   | otherwise = v!(k-1) + v!(k-2)
 }}}

 Boring example, I know...

-- 
Ticket URL: <http://trac.haskell.org/vector/ticket/15#comment:4>
vector <http://trac.haskell.org/vector>
Package vector


More information about the vector mailing list