
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 9/29/10 23:17 , Russ Abbott wrote:
I never realized that a guard can be used as an extension of a pattern. Is this recommended coding? elem n xs asks whether n is an element of xs
Yep (although perhaps not ideal in this particular case). Moreover, the same things work in case statements (which function definition by patterns desugar to); IIRC "if c then t else e" is internally converted to "case () of () | c -> t | _ -> e". - -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkykEGIACgkQIn7hlCsL25WeaACguJXxy2EqO0suNG0KxRVBC2aP aAEAmwXt6sBk9Unb/hbNxPzP16v6NtFS =sVav -----END PGP SIGNATURE-----