[Haskell-beginners] Finding Keith Numbers with Haskell

Alexander Berntsen alexander at plaimi.net
Wed Nov 12 09:07:03 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 11/11/14 16:17, Kim-Ee Yeoh wrote:
> On Tue, Nov 11, 2014 at 8:26 PM, Jack Mott <jack.mott at gmail.com> 
> wrote:
> 
>> Thanks, is the notation with the single quote (isKeith') a 
>> convention for helper functions or does it actually change 
>> something about the program?
> 
> 
> An unspoken coding convention.
> 
> Function foo' would be read "foo-prime". E.g.of usage:
> haskell-prime is the next standard of haskell, which became moot
> because you need good vibes for diverse peoples to collaborate on
> such an undertaking, including supporting it by writing more than
> one implementation.
> 
> Strictly syntax, the compiler doesn't treat it differently from
> any other name label.
> 
> So yes, you could have foo-double-prime and so forth.
It's inherited from maths (like everything else). Very commonly used
for a changed/new version of something. Comes up a lot in games
programming. One banal example:

update :: World -> World
update (World p p2 b e) =
  let p'  = update p
      p2' = update p2
      b'  = update b
      e'  = update e
  in  World p' p2' b' e'
  where update = draw . move . react
- -- 
Alexander
alexander at plaimi.net
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlRjIzcACgkQRtClrXBQc7WPHwEAuIDb/vALYJ6Duz2ZDdB/tqHs
l35idQYgOkngDrVe4pwA/0PcF4IUv8MwBAOI3kE8OiBDFTPhsS2SlRtmgihqXwty
=XyN/
-----END PGP SIGNATURE-----


More information about the Beginners mailing list