标签: haskell function-composition
这是通过foldl连接的无用案例,纯粹是教育性的(对我而言):
foldl
foldl (\xs x -> xs ++ [x]) [1,2] [11,12,13] [1,2,11,12,13]
有没有办法将它打包得更紧,使用构图而不是lambda?
答案 0 :(得分:1)
这是从HTNW和Will Ness的评论中提取的更易读的摘要:
-- Reduction to poinfree a = \xs x -> xs ++ [x] b = \xs x -> xs ++ return x c = \xs x -> ((xs ++) . return) x d = \xs x -> ((. return) (xs ++)) x e = \xs x -> ((. return) . (++)) xs x