1 module Testsuite

.Utils

.List

( accum, (//) )
6 accum :: (a

-> b

-> a

) -> [a

] -> [(Int,b

)] -> [a

]
7 accum f xs ps

= go xs ps

' 0
9 ps

' = sortBy (\p q

-> compare (fst p

) (fst q

)) ps

11 go

(x

:xs

) ((i

,y

) : ps

) j

12 | i

== j

= go

(f x y

: xs

) ps j

13 go

(x

:xs

) ps j

= x

: go xs ps

(j

+1)
16 (//) :: [a

] -> [(Int, a

)] -> [a

]
17 xs

// ps

= go xs ps

' 0
19 ps

' = sortBy (\p q

-> compare (fst p

) (fst q

)) ps

21 go

(x

:xs

) ((i

,y

) : ps

) j

22 | i

== j

= go

(y

:xs

) ps j

23 go

(x

:xs

) ps j

= x

: go xs ps

(j

+1)