Confused about seq and forms.

Konst Sushenko konsu@microsoft.com
Thu, 18 Apr 2002 23:00:08 -0700


Jay Cox wrote:

>=20
>=20
> Any referal to a paper describing the differences between HNF and WHNF
> (yes, that includes yours Simon PJ!) would be appreciated.  Actually,
> I really, really want that reference to at least read that=20
> bit about WHNF.


I found "Functional Programming" by Field and Harrison (ISBN 0201192497)
useful:

An expression E is in HNF if:
  1. E is a constant or a variable
  2. E is an expression of the form \x_1.\x_2...\x_n.M, where expression
M is not a redex, n > 0
  3. E is of the form P E_1 E_2 ... E_n, where P is a function of arity
k > n, n >=3D 0

and E is in WHNF if:
  1. E is a constant or a variable
  2. E is an expression of the form \x.M, for any sub-expression M
  3. E is of the form P E_1 E_2 ... E_n, where P is a function of arity
k > n, n >=3D 0


In other words, as I understand it, the difference between HNF and WHNF
is that any lambda abstraction is in WHNF but only those lambda
abstractions that have irreducible bodies are also in HNF.

In all other respects WHNF and HNF are identical, that is, any variable
and constant is in both WHNF and HNF, and any patially applied function
is also in both forms.

Any corrections are welcome!

konst