zoukankan      html  css  js  c++  java
  • 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 $ 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
    

      

  • 相关阅读:
    关于网页编码转换的几种方法
    java加载静态properties的方法
    js 点击 li 获取 设定的参数信息
    添加网关信息
    SQL 函数
    SQL Date函数
    SQL 视图(VIEW)
    SQL高级语法3
    SQL 约束
    SQL 创建表
  • 原文地址:https://www.cnblogs.com/long123king/p/3842277.html
Copyright © 2011-2022 走看看