码迷,mamicode.com
首页 > 其他好文 > 详细

trizip haskell implementation

时间:2014-07-14 22:28:04      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:blog   http   for   io   div   re   

  1 trizip :: [a] -> [b] -> [c] -> [(a,b,c)]
  2 trizip a b c
  3         | null a = []
  4         | null b = []
  5         | null c = []
  6 trizip (x:xs) (y:ys) (z:zs) = (++) [(x,y,z)] (trizip xs ys zs)

  

daniel@daniel-mint ~/haskell $ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :l trizip.hs
[1 of 1] Compiling Main             ( trizip.hs, interpreted )
Ok, modules loaded: Main.
*Main> trizip [1..100] [‘a‘..‘z‘] [‘A‘..‘Z‘]
[(1,‘a‘,‘A‘),(2,‘b‘,‘B‘),(3,‘c‘,‘C‘),(4,‘d‘,‘D‘),(5,‘e‘,‘E‘),(6,‘f‘,‘F‘),(7,‘g‘,‘G‘),(8,‘h‘,‘H‘),(9,‘i‘,‘I‘),(10,‘j‘,‘J‘),(11,‘k‘,‘K‘),(12,‘l‘,‘L‘),(13,‘m‘,‘M‘),(14,‘n‘,‘N‘),(15,‘o‘,‘O‘),(16,‘p‘,‘P‘),(17,‘q‘,‘Q‘),(18,‘r‘,‘R‘),(19,‘s‘,‘S‘),(20,‘t‘,‘T‘),(21,‘u‘,‘U‘),(22,‘v‘,‘V‘),(23,‘w‘,‘W‘),(24,‘x‘,‘X‘),(25,‘y‘,‘Y‘),(26,‘z‘,‘Z‘)]
*Main> 
[11]+  Stopped                 ghci

  

trizip haskell implementation,布布扣,bubuko.com

trizip haskell implementation

标签:blog   http   for   io   div   re   

原文地址:http://www.cnblogs.com/long123king/p/3842277.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!