[Haskell-cafe] loop problem

Alexander Berntsen alexander at plaimi.net
Sat May 10 16:27:12 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Roelof,

Have you considered reading LYAH[0]? It is very good, and you can make up your own exercises if there aren't enough of them for you. :-)

[0]  <http://learnyouahaskell.com/>


P.S.
> main = putStr . unlines . map (unwords . map show . (\n -> [n,n^2])) $ [1..100]
While we're having fun golfing, my attempt:

mapM_ (\(x, y) -> printf "%d %d\n" x y) $ [(n, n^2) | n <- [1..100]]
- -- 
Alexander
alexander at plaimi.net
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlNuU2AACgkQRtClrXBQc7WzawEAt4TWloH3QhvC6vvHn4Xx2FAB
jwwsGzhe7GR/gKYcikcA/2tR1IlDVIIERjk2AnRccuGIqmNQZeT7ODdwuiw3mbCk
=WO8R
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list