Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import Data.List
rec :: Num a => [a] -> [a] -> [Int] -> [a]
rec c b m = a
where a = c++rest
rest = next [] 0 m
next xs k (m:ms)
| k == m = next (a:xs) k ms
| otherwise = val ++ next (map tail xs) (k+1) (m:ms)
where val = if (k<length c) then [] else [sum $ zipWith (*) (reverse (map head xs)) b]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment