Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
Let's review some of the Haskell concepts you have been learning on your own.
 

Summary: 3/30/2011
1
Haskell
Let's review some of the Haskell concepts
you have been learning on your own.
The answers are included, but try it
yourself first.
Exercises don't use built in functions
for these as we want the practice
Write a recursive function to add up all the
b i li tnumbers in a list
"flatten" a list of lists into a list
concat [[1,2], [], [3], [4,5]]
= [1,2,3,4,5]
3/30/2011
2
sum' [] = 0
sum' (x:xs) = x+ sum' xs
flatten' [] = []
flatten' (x:xs) = x++ flatten' xs

  

Source: Allan, Vicki H. - Department of Computer Science, Utah State University

 

Collections: Computer Technologies and Information Sciences