2015-05-01ãã1ã¶æéã®è¨äºä¸è¦§
表é¡ã®ã¨ããã§ãã 第åä¸å #æ¸è°·java (2015/05/30 14:00ã)shibuya-java.connpass.com ã§ãçºè¡¨ãã¦ãã¾ããã On stream-lazy-computation from mike_neck Mochida www.slideshare.net å®éã®ãã¬ã¼ã³ã®å 容ã¯ããå°ãä¸å¯§ãã¤éãªè³æã§ããã¾ããã Jaâ¦
表è¨ã®ã¨ããã§ãããªããæ¬æã¯ãã³ãºãªã³ã®çæéã§æ¸ãã¦ãã¾ãã ãæ±äº¬ãJJUG ãã¤ãã»ããã¼ ãGS Collections éå ´ãjjug.doorkeeper.jp åå¼·ä¼ã®å 容çã«ã¯æãåããã¦ããæéãé·ãã£ãã®ã§ããã¤ã¼ãã¯å°ãªããªã®ã§ãå¤åãã¥ã²ãã¿ã¼ã¯ãªãã¨æâ¦
Scalaã®catsã¨ããã©ã¤ãã©ãªã¼ã®ããã¥ã¡ã³ãèªãã§ã¦ãHaskellããããªãã¦æã£ã¦ã¾ããã Cats Documentation - Typeclasses ã§ãè¥å¹²æ°ã«ãªã£ããã¨ãããã¾ãã¦ãJavaã®ç«å ´ã§Scalaã®implicit parameterãè¦ã¦ãã¦ããªããæªãããªæãã®ããé¢æ°ã ãªã¼â¦
ãã®ãããªãªã¹ãã«å¯¾ããæ¨æºçãªå帰ãã¿ã¼ã³ã§ã¯ãå帰ãæ示çã«æ¸ãããããç³è¾¼ã¿ã使ãã»ããããã§ãããããã®ã»ããèªã¿ãããç解ããããããã§ããfoldrã®å¼ã³åºãã¯èª°ãè¦ã¦ãç³ã¿è¾¼ã¿ã§ãããæ示çãªå帰ãèªãã«ã¯èããæéãå¿ è¦ã§ãã â¦
å ã«ãªã£ãè¨äºã¯ããã Java 8 Streamã®æåã調ã¹ãã£ã - mike-neckã®ããã°mike-neck.hatenadiary.com ãã¤ãã©ã¤ã³ä¸ã¤ä¸ã¤ããªã³ã¯ããªã¹ãç¶ã®Streamã®ã¤ã³ã¹ã¿ã³ã¹ã§æ§æããã¦ããã¨ãããã¨ã§ãã©ããããã®é·ãã®ã¹ããªã¼ã ãã¤ãã©ã¤ã³ãæ¸ãã¨Oâ¦
第åç« å帰ãéè¦ãªçç± åé¡ã大ããªåé¡ããããå°ããªåé¡ã«å解ãã ãã以ä¸åããããªãåºåºé¨ã¾ã§å解ãã åºåºé¨ã§ã¯è§£ãæ示çã«å®ç¾©ãã 大ããªåé¡ã¯é¢æ°ãèªåèªèº«ã«å帰çã«é©ç¨ãããã¨ã§é¨ååé¡ãå帰çã«è§£ãã¦ãã æçµçã«è§£ãé¨åçãªâ¦
ä½ãè¨ã£ã¦ãããããããªãã¿ã¤ãã«ã§ãããã§ãåé¢éããªã®ã§ãã Stackageã®LTS Haskell便å©ãªã®ã§ãããæ´æ°é »åº¦ãé±1åããããã£ã¦ã次ã®Qiitaã®æé ãè¡ãã®ãé¢åãªã®ã§ããªãã¨ããããã£ãã®ã§ããããã¾ãã«ã·ã§ã«ã¡ãããªãããã¦gradleã§ããâ¦
gradle2.4ã®ãªãªã¼ã¹ãã¼ããå æ¥çºãã¦ãããRule based model configuration improvementsã¨ããè¨è¿°ããã£ã¦ããã®ã¦ã¼ã¶ã¼ã¬ã¤ãã®ã³ã¼ãã試ãã¦ã¿ã¾ããã ã¢ãã« ã¢ãã«(POJO)ãããããã¤ã³ã¿ã¼ãã§ã¼ã¹ãManagedã¢ããã¼ã·ã§ã³ãä»ä¸ãããã¨ã«ãã£â¦
表è¨ã®ã¨ããã§ãã ä¸å¿ãç°¡åãªHaskellã®ããã°ã©ã ã¯æ¸ãããããããªããããªæ°ãããããã«ãªãã¾ããã 第ä¸é¨ã®ãããã¯å ·ä½çã«ããã°ã©ã ãæ¸ãã¤ã¤éã¶ãã¨ãã§ããã®ã§ããããªãã«èº«ã«ã¤ãæãããã¾ãããã ãå 容çã«ã¯æ·±å ãã¯ãã¦ããªãã®ã§â¦
ãã¾ãæãã¤ããªããã©ã¾ã¨ãã¦ã¿ã DBã®è«çåé¤ åå¼·ä¼ãã£ã³ã»ã« ãã®è¨èªããããããã§ããªãããã¯ã½âããããã®è¨èªã³ãã¥ããã£ã§ã®æ¦äºåçº ââãæ¡ç¨ãã¹ã10ã®çç± ã¡ã¼ã«ã§ãã¹ã¯ã¼ãã¤ãzipã¨ä¸ç·ã«å¹³æã§ãã¹ã¯ã¼ããéããã¦ãã(2015/05/15 â¦
第10ç« ã¨ã³ãã£ã㣠å¤æ° åã³ã³ã¹ãã©ã¯ã¿ ãã¼ã¿ã³ã³ã¹ãã©ã¯ã¿ ãã£ã¼ã«ãã©ãã« åã¯ã©ã¹ ã¯ã©ã¹ã¡ã½ãã ã¢ã¸ã¥ã¼ã«å®ç¾© åºæ¬çãªå½¢ module Repository where ç¹å®ã®ã¨ã³ãã£ãã£ã®ã¿ã¨ã¯ã¹ãã¼ããã module Repository (findById, save) where ãã¼â¦
ãã¾ãç«ã«æ²¹ã注ããããªãã¨ã¯ããããªãããè°è«ããã¦ãããã¨ã®å 容ãåã®é ã§ç解ã§ããã¬ãã«ãè¶ ãã¦ããã®ã§ããã¾ãæ¸ãããã¯ãªããã©ãã¾ãéæã¨ããæãã§ã ãScalaã§ã§ãããã¨Javaã§ã§ãããã¨ä»¥ä¸ã®ãã¨ã¯ã§ããªããçãªãã¤ã¼ãã®å¾ãã¾â¦
åãªãèªæ¸ã¡ã¢ 代æ°çãã¼ã¿å å®ç¾©ã®ä»æ¹1 - æ§é ä½ã£ã½ã ã©ãã«ãªãã³ã³ã¹ãã©ã¯ã¿ã¼ -- Studentåã®å®ç¾© data Student = Student String String -- ã¤ã³ã¹ã¿ã³ã¹å student = Student "Paul" "Smith" -- ãã¿ã¼ã³ããã printStudent:: Student -> IO()â¦
åãªãèªæ¸ã¡ã¢ ç¡åé¢æ° æ¸ãæ¹ \n -> n * n 使ãæ¹ map (\n -> n * n) [1,2,3,4] é¢æ°åæ æ¸ãæ¹ before lineCount:: String -> Int lineCount s = length $ lines s after lineCount:: String -> Int lineCount = length . lines é¨åé©ç¨ ä¾:5ã®åæ°ãâ¦
表è¨ã®ä»¶ã«ã¤ãã¦ãJavaã®Listããä½ãStreamã¯æä½ä¸ã«å¤æ´ãããã¨ãã®å¾ã®æåã«ã¤ãã¦ãªããçµæãä¿è¨¼ããªãã®ã§ãListããStreamãä½ã£ãå ´åã¯ãå¤æ´ãããªããããããã¯ä¸å¯å¤ãªListã«å¤æãã¦ããä½ãã®ãè¯ãã§ãã ã¨ãæ¸ãã¦ããã¦ãããªã®ã§ãâ¦
表è¨ã®ã¨ããã§ãã ãã®æ¬å ¨ä½ã¨ã㦠ãªã¬ã¼ã·ã§ãã«ã¢ãã«ã®å¾¹åºã»éç NULLã®æ²æ» çç¾ãã¨ã«ããé¿ããã㨠ã¨ãããã¼ããä¸è²«ããã¦ããæ¬ã ã£ãã ãªã¬ã¼ã·ã§ãã«ã¢ãã«ã®å¾¹åºã¨ããã®ã¯ãçµå±ã®ã¨ããçç¾ãé¿ãããã¨ãªã®ã ã⦠ãã®ä¸ã§ãå®éã®ã¢â¦
ããµã¤ãã®Haskellããèªãã§ã¦ç«¹å é¢æ°ã¨ããã®ãåºã¦ããã®ã§ããããJavaã§ãã£ã¦ã¿ããã¨æã£ãã ã¡ãªã¿ã«ç«¹å é¢æ°ã¨ã¯ 竹å é¢æ°ï¼ãããã¡ããããï¼ã¯ãããã°ã©ãã³ã°è¨èªå¦çç³»ã®ãã³ããã¼ã¯ãªã©ã«ä½¿ããããå帰çã«å®ç¾©ãããé¢æ°ã§ããã Wikipâ¦
æ¨è¨ã®ä»¶ã«ã¤ãã¦ãä»ããµã¤ãã®Haskellããèªãã§ãHaskellãå°ããã¤ãã£ã¦ãã¾ãã ãã®åã¾ã§Scalaãåå¼·ãããã¨ãã¦ããã®ã«ããªãHaskellã¨ããçåãããã¾ãããããã¯åç´ã«åã®ã¡ã³ã¿ã«ã¢ãã«ã¨ãããæèã¢ãã«ã¨ããããããã«èµ·å ããã¨ããã§â¦
JUnitã«è¿½ãã¤ãã(2å¨åé ããç·åä¸ä¸ã¡ã¼ãã«ã ã¨2åè¿ãã®å·®ãç®±æ ¹é§ ä¼ãªã4å40ç§ã®å·®)ã¨ãã趣æ¨ã®ã¨ã³ããªã¼ã§ãã è¦ç´ã¯ãã£ã¡ãè¦ãã»ããæ©ãã£ã JUnit 4.12ã®æ°æ©è½ç´¹ä»ã¾ã¨ã - ãããçµkyon-mm.hatenablog.com JUnit4.12ã«è¿½ãã¤ããï¼å¨åé â¦
ããµã¤ãã®Haskellãã®èªæ¸ã¡ã¢ æ¨æºã®é¢æ°ã¾ã¨ã é¢æ° å åä½æ¦è¦ == a -> a -> Bool 第ä¸å¼æ°ã¨ç¬¬äºå¼æ°ãæ¯è¼ããçµæãè¿ã lines String -> [String] æ¹è¡æåã³ã¼ãã§åºåã£ã¦ãªã¹ãã«å¤æ words String -> [String] åèªã«å解ãã length [a] -> Inâ¦
表è¨ã®ã¨ããã§ãã Java8ã®FunctionalInterface群ã¯ä½¿ãåæãããã¦ããã£ã¡ã主ã«ä½¿ã£ã¦ãã¾ããããGroovyãJava8ã®è¨èªä»æ§å¯¾å¿ãé²ãã¦ã¦ãGroovy2.4.3ãã(ãã以åããï¼)㯠def func = [apply: {s -> s.size()}] as Function<String, Integer> ãªã©ã¨æ¸ããªãã¦ãClo</string,>â¦
åãªãèªæ¸ã¡ã¢ æ£è¦å½¢ 第ä¸æ£è¦å½¢(1NF) 第äºæ£è¦å½¢(2NF) 第ä¸æ£è¦å½¢(3NF) ãã¤ã¹ã³ããæ£è¦å½¢(BCNF) 第åæ£è¦å½¢(4NF) 第äºæ£è¦å½¢(5NF) 第å æ£è¦å½¢(6NF) é«ãã¬ãã«ã®æ£è¦å½¢ã¯ãããããä½æ¬¡ã®æ£è¦å½¢ã®è¦ä»¶ãæºãã è¨è¨æã«ç®æãç®å®ã¯BCNFãããã¯5NF 2NFâ¦
æ¨æ¥Haskellã®ç°å¢ãä½ã£ã¦ã¿ãã®ã ããcabal install ghc-modã3åã»ã©å¤±æãã¦ã(#ï½ç¿Â´)ã°ããã¨ãªã£ã¦ãæå¾ã®æ¹æ³ã ããã¾ã¨ãã«ãã¾ããã£ãã®ã§ããã®ã¡ã¢ãåºæ¬çã«ã¯ä¸è¨ã®ãµã¤ããå ãã¿ã§ãåã®ã¨ã³ããªã¼ã¯ä¿ºå¾ãªã¡ã¢ã§ãã Macã«haskellãã¤ã³â¦
ãã£ã¨ã³ããæ¬èªã¿çµãã£ãã 700ãã¼ã¸ã¨ãããµã¤ãºã«éä¸ãã©ãã©èªãã§ãã¾ã£ããããã»ã¨ãã©å 容ãé ã®ãªãã«æ®ã£ã¦ãªããé·ãæ¬ã¯1æ¥100ãã¼ã¸ã¨ãç解ã¯ã©ãã§ãããããã¹ãã¼ããé«ãã¤ã¤èªã¿ãã(ã©ããå¾ã§ã¾ãèªã¿ãªããã®ã§)ã ã¨ãããããè¦â¦