I’m reading A Gentle Introduction to Haskell (which is not so gentle) and it repeatedly uses the : operator without directly explaining what it does.
So, what exactly does it do?
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.
:is the “prepend” operator:Returns a list which has
xas first element, followed by all elements inxs. In other functional languages, this is usually calledcons, because it “cons”tructs a list recursively by repeated application from an empty list:is the list
[1, 2, 3, 4].