
24 Oct
2011
24 Oct
'11
4:21 p.m.
Hi Folks, I have a lambda expression that can be used to construct a list of values: cons = (\a -> (\b -> (\f -> f a b))) Here is an example that uses cons to construct "hello" hello = cons 'h' (cons 'e' (cons 'l' (cons 'l' 'o'))) And here is a lambda expression that returns the tail of a list created using cons: tail' = (\c -> c (\a -> (\b -> b))) I would like to create a function that computes the length of a cons-created list: length' = \xs -> if ( null' xs ) then 0 else length' (tail' xs) + 1 How would I define null' to determine if a cons list is empty? null' = ??? /Roger