首页 > 其他 > 详细

trizip haskell implementation

时间:2014-07-14 22:27:41      阅读:402      评论:0      收藏:0      [点我收藏+]
  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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!