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. 03 synchronized

    synchronized 1. 锁机制的特性 互斥性:在同一时间只允许一个线程持有某个对象锁(原子性) 可见性:必须确保在锁被释放之前,对共享变量所在的修改,对于随后获得该锁的另一个线程是可见的 2. ...

  2. SpringBoot-技术专区-详细打印启动时异常堆栈信息

    SpringBoot在项目启动时如果遇到异常并不能友好的打印出具体的堆栈错误信息,我们只能查看到简单的错误消息,以致于并不能及时解决发生的问题,针对这个问题SpringBoot提供了故障分析仪的概念( ...

  3. C# WCF 服务引用与Web引用

    参考:https://blog.csdn.net/yelin042/article/details/82770205

  4. 【学习总结】gcc和gdb

    目录 <> vim.gcc.gdb: gcc: gcc和g++是c/c++的linux系统集成的编译器,源文件的后缀应为 .C/.cpp/.c++/.cc等 编译器可以将C.C++等语言源 ...

  5. 2018-2-13-C#-Find-vs-FirstOrDefault

    title author date CreateTime categories C# Find vs FirstOrDefault lindexi 2018-2-13 17:23:3 +0800 20 ...

  6. vue,一路走来(3)--数据交互vue-resource

    所有的静态页面布局完成后,最重要的就是数据交互了,简单来说,vue-resource就像jquery里的$.ajax,用来和后台交互数据的.放在created或ready里运行来获取或者更新数据的.不 ...

  7. 二、SQL Server 分页

    一.SQL Server 分页 --top not in方式 select top 条数 * from tablename where Id not in (select top 条数*页数 Id f ...

  8. 四 shell基本命令

    一   内置命令 hlep 命令  帮助 help test help -s printf   显示内置命令的语法格式 echo 用来显示一行文字 echo "hello world&quo ...

  9. 前端学习(三十六)promise(笔记)

    一个页面:  头部.用户信息.新闻列表 jquery ajax:  1.$.ajax({    url:'',    dataType:'json', }).then(res=>{    //r ...

  10. ltp-ddt realtime_cpu_load timeout

    # @name Worstcase Latency with cpu load by using cyclictest# @desc Measure latency under cpu load by ...