Is there any way to clone a list in Haskell? I can’t find any documentation on this or anything on SO. If there isn’t can someone suggest a simple implementation on how to do so?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Haskell values are immutable. “Modifying” a list is just transforming it into a new list; the original list is never changed. So, since lists can’t change in the first place, there’s no need to clone them; you can just reuse the original list.