hpaste

recent | annotate | new

run function state [] = []
run function state (input:inputs) =
    let (output, state') = function input state
    in output : (run function state' inputs)


Main> run splitAt [1..] [3, 1, 4, 2]
[[1,2,3],[4],[5,6,7,8],[9,10]]


takeSubL [] _ = []
takeSubL (x:xs) ys = take x ys : takeSubL xs (drop x ys)