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的更多相关文章

  1. Finding the Longest Palindromic Substring in Linear Time

    Finding the Longest Palindromic Substring in Linear Time Finding the Longest Palindromic Substring i ...

  2. Haskell语言学习笔记(30)MonadCont, Cont, ContT

    MonadCont 类型类 class Monad m => MonadCont m where callCC :: ((a -> m b) -> m a) -> m a in ...

  3. Haskell语言学习笔记(25)MonadState, State, StateT

    MonadState 类型类 class Monad m => MonadState s m | m -> s where get :: m s get = state (\s -> ...

  4. Haskell语言学习笔记(24)MonadWriter, Writer, WriterT

    MonadWriter 类型类 class (Monoid w, Monad m) => MonadWriter w m | m -> w where writer :: (a,w) -& ...

  5. Haskell语言学习笔记(23)MonadReader, Reader, ReaderT

    MonadReader 类型类 class Monad m => MonadReader r m | m -> r where ask :: m r ask = reader id loc ...

  6. [Real World Haskell翻译]第22章 扩展示例:Web客户端编程

    第22章 扩展示例:Web客户端编程 至此,您已经看到了如何与数据库交互,解析一些数据,以及处理错误.现在让我们更进了一步,引入Web客户端库的组合. 在本章,我们将开发一个真正的应用程序:一个播客下 ...

  7. Concepts & Implementation of PLs

    http://perugini.cps.udayton.edu/teaching/courses/Spring2015/cps352/index.html#lecturenotes Programmi ...

  8. 怎样使用haskell编写应用程序

    参考:http://stackoverflow.com/a/9153617 http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_prog ...

  9. 与项目欧拉速度比较:C vs Python与Erlang vs Haskell

    我从问题#12 ProjectEuler作为编程练习,并比较我在C,Python,Erlang和Haskell中的实现(当然不是最优)实现.为了获得更高的执行时间,我搜索了第一个有1000个以上因子的 ...

随机推荐

  1. POJ-1679.The Unique MST.(Prim求次小生成树)

    The Unique MST Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 39561   Accepted: 14444 ...

  2. python读取ini文件时,特殊字符的读取

    前言: 使用python在读取配置文件时,由于配置文件中存在特殊字符,读取时出现了以下错误: configparser.InterpolationSyntaxError: '%' must be fo ...

  3. 最长公共上升子序列 (LIS+LCS+记录)

    [题目描述] 给出两个序列,求出最长公共上升子序列的长度,并输出其中一个解. [题目链接] http://noi.openjudge.cn/ch0206/2000/ [算法] 经典问题,结合了LIS和 ...

  4. poj Meteor Shower

    这道题是下流星,流星会下到上下左右中的位置,而且有时间的,要你求出最短到达安全位置的时间. 这道题要注意边界是可以超过300的 #include<stdio.h> #include< ...

  5. asp.net 连续打印多份HTML页面,出现漏字

    在IE8上打印的内容用了CSS 样式,连续打印多份导致的 可以通过改变CSS样式或更换浏览器解决

  6. vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin

    场景: . webpack2.4.*集成vue-loader@15.7.2报错 原因: 参考官方文档 https://vue-loader.vuejs.org/migrating.html#a-plu ...

  7. CSS3中resize属性

    说明: resize属性是指定一个元素是否可由用户调整大小的. 语法: resize:none | both | horizontal | vertical none:用户不可一调整元素的尺寸(默认值 ...

  8. Linux修改密码指令

    1.在选择系统菜单界面,按 "e" 进入编辑模式 2.在以字符串“Linux16”开头的行,将光标移动到该行的结尾,然后输入“init=/bin/bash”,按 "Ctr ...

  9. weblogic启动脚本

    DATE=`date +%Y%m%d%H%M%S` user=`whoami` logDir=/app/logs/sguap_admin #启动日志存放路径sguap是例子系统简称# logDestd ...

  10. jQuery给css增加!important

    <div id='ele' style=''width:200px!important"><div> JS $("#el").css(" ...