[Haskell-beginners] Offside rule for function arguments?

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Mon Aug 23 15:02:50 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/23/10 14:56 , Isaac Dupree wrote:
> On 08/23/10 02:33, John Smith wrote:
>> Why doesn't Haskell allow something like this?
>>
>> fac 0 = 0
>>     1 = 1
>>     x = x * fac (x-1)
>>
>> This would be clearer than repeating the function name each time, and
>> follow the same pattern as guards and case.
> 
> Layout is detected and parsed when and only when it is preceded by 'where',
> 'let', 'do', or 'of'.  So Haskell would have to have some such keyword to

I think the next question is "so how do guards work?"

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at 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/

iEYEARECAAYFAkxyxdoACgkQIn7hlCsL25VVqgCg0tLmPDFClCTgr1ExoSFZOMMT
ri4AoM2MX9vRXMo0YHuiX4PIgPiGi/GV
=l0lN
-----END PGP SIGNATURE-----


More information about the Beginners mailing list