Functional Programming (H) - 5.04 - To Infinity (but not beyond)

1. How do we generate an infinite list of integer 1 values?

2. Which one of the following functions will not loop infinitely, if we evaluate it in ghci?

3. Given a Tree data type as defined earlier in the course:

data Tree = Leaf | Node Int Tree Tree deriving Show

with Leaf and Node constructors, then how do we define an infinite tree?

4. Which one of the following expressions generates an infinite list of successive factorial numbers? (Recall that the nth factorial is the product of the first n positive integers.)

5. Does the following expression terminate?

let bot = bot bottomList = repeat bot in length(take 5 bottomList)