# Strictness making it worst?

**Jorge Adriano
**
jadrian@mat.uc.pt

*Thu, 29 Nov 2001 20:25:31 +0000*

>* Then I tried:
*>* > sfibac :: IntPos -> (IntPos,IntPos) ->
*>* > (IntPos,IntPos) sfibac n (a,b)
*>* >
*>* > | n == 0 = (a,b)
*>* > | otherwise = sfibac (n-1) (b, (+b) $! a)
*
I'm sorry I meant:
>* sfibac :: IntPos -> (IntPos,IntPos) ->
*>* (IntPos,IntPos) sfibac n (a,b)
*>*
*>* | n == 0 = (a,b)
*>* | otherwise = sfibac (n-1) (b, (a+) $! b)
*
otherwise the reductions would be wrong
>* fibac:
*>* sfibac 4 (a, b) ->
*>* sfibac 3 (b, a+b) ->
*>* sfibac 2 (c, b+c) ->
*>* sfibac 1 (d, c+d) ->
*>* sfibac 0 (e, d+e)
*
In fact I would expect that using ((a+) $! b) would be better than (b, (+b)
$! a), but the 1st seemed to be the worst in terms of both speed and stack
space problems.
J.A.