Defining infinite list in Haskell:
[1,1..] => [1,1,1,..]
Or, the circular way:
lst=1:lst
Is the first defined the same as the second? If not, which one is the preferred way?
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.
You probably want
repeatwhere the definition is equivalent to your second implementation.The
[1,1..]notation in your first example is syntactic sugar for theenumFrom*prelude functions. Use whichever you prefer.