Hi,

Suppose you have some function

functn :: Int -> Int
functn i
    | i>5       = t  * i
    | i>0       = t_ * i
    | otherwise = 1
    where
    t  = functn (i-2)
    t_ = functn (i-1)

Notice that t and t_ are really local to a guard, rather
than to the whole guard section.  Why then, can't you write:

functn :: Int -> Int
functn i
    | i>5       = t * i
        where
        t = functn (i-2)
    | i>0       = t * i
        where
        t = functn (i-1)
    | otherwise = 1

In particular, the above would mean you wouldn't need two names 
t and t_, you could just use t for both!

Am I doing something wrongly, or is there a good reason why
where isn't allowed to be used in this way?

Thanks,

Mark.


-- 
Dr Mark H Phillips
Research Analyst (Mathematician)

AUSTRICS - smarter scheduling solutions - www.austrics.com

Level 2, 50 Pirie Street, Adelaide SA 5000, Australia
Phone +61 8 8226 9850
Fax   +61 8 8231 4821
Email [EMAIL PROTECTED]

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to