首页 > 代码库 > trizip haskell implementation
trizip haskell implementation
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 $ ghciGHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for helpLoading 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。