Browse thread
Unexpected restriction in "let rec" expressions
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dirk Thierbach <dthierbach@g...> |
| Subject: | Re: [Caml-list] Unexpected restriction in "let rec" expressions |
On Wed, Feb 27, 2008 at 03:04:03PM +0100, Loup Vaillant wrote: > Yes, it does, but I have difficulties reducing this expression. Where is the problem? > Do you have another example which can be reduced to head normal form > (say the result is an int instead of a list)? Not with ground types, but would the factorial function help? f (x,g) = (g x, g') where g' 0 = 1 g' y = y * g (y-1) *Main> [loop f x | x <- [0..10]] [1,1,2,6,24,120,720,5040,40320,362880,3628800] One can imagine that in a similar way to the list: The function g goes round the loop and more and more results get defined. BTW, lazy evaluation uses weak head normal form (WHNF), not head normal form. - Dirk