POV-Ray : Newsgroups : povray.off-topic : 80 / 20 rule : Re: 80 / 20 rule Server Time
8 Jul 2024 08:14:03 EDT (-0400)
  Re: 80 / 20 rule  
From: Orchid Win7 v1
Date: 25 Oct 2015 10:48:13
Message: <562cebad$1@news.povray.org>
On 17/10/2015 02:09 PM, Orchid Win7 v1 wrote:
> I've been a Haskell programmer for [at least] 10 years, and I've never
> seen *anybody* do this!

In other news...

It turns out guards are weirder than I thought! Most humans use them 
like this:

   fibonacci n | n == 0    = 1
               | n == 1    = 1
               | otherwise = fibonacci (n-1) + fibonacci (n-2)

Or maybe

   fibonacci n
     | n == 0    = 1
     | n == 1    = 1
     | otherwise = fibonacci (n-1) + fibonacci (n-2)

But it turns out, it's 100% legal to do this:

   fibonacci n | n == 0 = 1 | n == 1 = 1 | otherwise = ...

How bizarre! I had no idea you could do this... I had assumed the layout 
rule applies. But, apparently, it does not. So long as all the guards 
end up in the same block, it literally doesn't matter. Who knew?

(I suppose most of this basically boils down to "most people don't use 
guards very much anyway"...)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.