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)

  

[email protected] ~/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

时间: 2024-08-29 12:03:26

trizip haskell implementation的相关文章

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

我从问题#12 ProjectEuler作为编程练习,并比较我在C,Python,Erlang和Haskell中的实现(当然不是最优)实现.为了获得更高的执行时间,我搜索了第一个有1000个以上因子的三角形数字,而不是原始问题中所述的500个. 结果如下: <强> C: [email protected]:~/erlang$ gcc -lm -o euler12.bin euler12.c [email protected]:~/erlang$ time ./euler12.bin 84216

Python integer objects implementation

http://www.laurentluce.com/posts/python-integer-objects-implementation/ Python integer objects implementation May 15, 2011 This article describes how integer objects are managed by Python internally. An integer object in Python is represented interna

Haskell环境搭建(windows)(一)

1.官网上(https://www.haskell.org/platform/windows.html)下载Haskell Platform,最新版本为8.2.1,只支持64位,有个core版和full版,full版包含了库,就下full版试试 2.cmd下输入 "cabal user-config init",可以看到配置文件的路径,找到配置文件,添加输入 extra-prog-path: C:\Program Files\Haskell Platform\8.2.1\msys\us

An Implementation of Double-Array Trie

Contents What is Trie? What Does It Take to Implement a Trie? Tripple-Array Trie Double-Array Trie Suffix Compression Key Insertion Key Deletion Double-Array Pool Allocation An Implementation Download Other Implementations References What is Trie? Tr

Python string objects implementation

http://www.laurentluce.com/posts/python-string-objects-implementation/ Python string objects implementation June 19, 2011 This article describes how string objects are managed by Python internally and how string search is done. PyStringObject structu

Python dictionary implementation

Python dictionary implementation http://www.laurentluce.com/posts/python-dictionary-implementation/ August 29, 2011 This post describes how dictionaries are implemented in the Python language. Dictionaries are indexed by keys and they can be seen as

Kernel logging: APIs and implementation

Kernel API Logging within the kernel is performed using the printk function int printk( const char * fmt, ... ); The kernel code simply defines the log level as the first argument of the message, as illustrated in the following example for a critical

Mac OS X 上的安装haskell开发环境

到haskell官方下载haskell的工具包: https://downloads.haskell.org/~platform/2014.2.0.0/Haskell%20Platform%202014.2.0.0%2064bit.signed.pkg adeMacBook-Pro:haskell_dev apple$ ghci GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-pri

函数式编程语言LISP,python,haskell,clojure

说说我自己的背景吧,我是个半吊子的程序员,做任何事情喜欢比较了解然后再尝试,我接触过很多语言,大多数都把它当成工具来使用 我现在的工作大部分主要在于数据挖掘与机器学习方面,也学习web开发,我第一个拿来工作的语言是python,我是从那里得知函数式编程的概念的 说起lisp据说python就是模仿的lisp,而得知这个语言是从黑客与画家这本书中得知的,据说是一个特别值得尝试的语言,由于作者说如果年龄超过25岁,最好不要尝试学习它,我明年就本命年了,看来应该试着尝试一下了 在之前面临招工作的时候曾