Skip to content

Instantly share code, notes, and snippets.

@Shimuuar
Created May 31, 2014 15:06
Show Gist options
  • Save Shimuuar/7da4d4312bffd937e810 to your computer and use it in GitHub Desktop.
Save Shimuuar/7da4d4312bffd937e810 to your computer and use it in GitHub Desktop.
Manual float out
import Debug.Trace
xs1,xs2 :: [Int]
xs1 = map (\x -> (trace "2" 2 + trace "3" 3) * x) [0..]
xs2 = map (let y = trace "2" 2 + trace "3" 3 in \x -> x*y) [0..]
{-
*Main> take 4 xs1
[2
3
0,2
3
5,2
3
10,2
3
15]
*Main> take 4 xs2
[2
3
0,5,10,15]
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment