If you sure "z" is the last element of A you can use
init A ++ B
if it's somwhere in the middle consider
cocat $ map f A
where
f x
| x == "z" = B
| otherwise = [x]On Sat, Nov 4, 2017 at 2:41 PM, Денис Мирзоев <nolane16@gmail.com> wrote:If you sure "z" is the last element of A you can use
init A ++ B
if it's somwhere in the middle consider
cocat $ map f A
where
f x
| x == "z" = B
| otherwise = [x]On Sat, Nov 4, 2017 at 1:57 PM, FlyingSheep <flyingsheep@qq.com> wrote:______________________________(take 2 A) ++ B------------------李 鹏
四川大学计算机学院------------------ 原始邮件 ------------------ 发件人: "mirone"<saul-mirone@qq.com>;发送时间: 2017年11月4日(星期六) 晚上6:48收件人: "haskell-cafe"<haskell-cafe@haskell.org >;主题: [Haskell-cafe] Replace list item with list.Hello everyone!If I have a list A : ["x", "y", "z"]and a list B: ["f", "g"].Here is my question:What's the simplest way to replace "z" in the list A by list B, and get ["x", "y", "f", "g"] ?_________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-caf e
Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell- cafe
Only members subscribed via the mailman list are allowed to post.