Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 288 Bytes

16-comprehension-bug.md

File metadata and controls

13 lines (10 loc) · 288 Bytes

Exercise 16

sub 5 = return [1]
sub x =
    do 
        xs <- sub (x - 1)
        return (x:xs)       

f xs = [ length (sub x) | x<-xs ]

sub 10 returns 10,9,8,7,6,1 but length (sub x) in the comprehension apparently returns 1 instead of 6. Fix the comprehension.