On 12-10-18 05:24 AM, Serge D. Mechveliani wrote:
And concerning this example: I am not even sure now that it worths to
setting  $!  there.
Because I deliberately program  qRem  as returning a pair  (quot, rem),
and do not program a separate function for  rem.  And to obtain  rem,
one applies   snd (qRem n m),  and due to laziness,  quot  does not
spend the cost. I do not know, may be, using $! may damage this style.

snd (quot, rem) does not spend the arithmetic cost of quot, but spends the memory cost of quot. Memory cost is not just occupation of memory, but also writing of memory and computing of addresses, which is not exactly cheaper than arithmetic.

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to