.groovy
ä»å¹´ãååãçµãããã¨ãã¦ããã1æã® TODO ã解決ããã 404 Blog Not Found:Algorithm - Suffix Array ã JavaScript ã§åçºæãã¦ã¿ã Suffix Array ã§ã¯ãªã BWT ã®æ¹ãã Groovy ã§å®è£ ãã¦ã¿ã åè http://homepage3.nifty.com/DO/blocksorting.htmâ¦
ããããHaskellãã®ããå¦ã¼ã!ã ã® 10ç« ã®éãã¼ã©ã³ãè¨æ³é»åã Groovy, Scala, Clojure, Scheme ã§æ¸ãã¦ã¿ãã Reverse Polish notation calculator Groovy def solveRPN(expr) { expr.tokenize().inject([]){ acc, v -> "*" == v ? [acc[1] * acc[0]â¦
æè¿è©±é¡ã®ã¿ã¤ãã«ã¯ããã®ããèªãã§ããéä¸ï¼9ç« ã«å ¥ã£ã)ã ãã®è©±ã§ã¯ãªãããã®ã¨ã³ããªã¯ Clojure 㧠Ninety-Nine Prolog Problems ããã£ã¦ããã¨ãã«æãã¤ãããã®ã 1. Prolog Lists - Prolog Site Ninety-Nine Prolog Problems ã Lists ã®ã¨ãâ¦
O'Reilly ã§ã¯ Open Feedback Publishing System ã¨ãã£ã¦å·çä¸ã®æ¸ç±ã«ã³ã¡ã³ãã§ããããã(ãã ã English)ã Online Feedback Publishing System - O'Reilly Media ã¨ãããã㧠Grails ã®æ¬ãåºãã¿ãã(ã¾ã ååãæ¸ããã¦ããªã)ã Online Feedback â¦
WEB+DB PRESS Vol.67 ã®æé·éè¤æåååé¡ããã£ã¦ã¿ãã ããå°ãåã«å®è£ ãã¦ããã®ã ãã© takeWhile å¾ ã¡ãã¦ããéã«ç®çãå¤ãã£ã¦ãã¾ã£ãã Clojure ã Scala ã§ã¯æ¢ã«å®è£ ããã¦ããæ¹ãããããã WEB+DB PRESS Vol.67ã®æé·éè¤æåååé¡ãClojuâ¦
Clojure ç·¨ã«ã¤ã¥ã Scala 編㸠Scala 㯠Haskell ã®å¤ãã®é¢æ°ãç¨æããã¦ããã®ã§ Haskell ããã®æ¸ãæããã®ã«ã¯æå©ã ã def makePair [T](xs: Seq[Seq[T]]) = xs zip xs.tail def comlen [T](p: (Seq[T],Seq[T])) = p.zipped takeWhile(x => x._1 == â¦
Clojure ãå¦ã¶ Groovy 㨠Scala 㯠Java ã®æååããçã¾ãããã®ã ããClojure 㯠Lisp ã®æååãã Java ã«å ¥ã£ã¦ãããã®ã ã é¢æ°ã®å¼ã³åºãã (é¢æ°å å¼æ°1 å¼æ°2 ...) ã¨åç½®è¨æ³ã§æ¸ãããªã¹ãã§ããã¨ãã㯠Lisp ã ããä»ã® Lisp ç³»è¨èªã«æ¯ã¹â¦
1å¹´åãããã«èªãã§ããããããªãã£ããã©ãããããç解ã§ããæ°ãããã®ã§æ¸ãã¦ã¿ãã ãªãé¢æ°ããã°ã©ãã³ã°ã¯éè¦ã *1 John Hughes æ°ã®ä¸»å¼µ ããã°ã©ã ãã¢ã¸ã¥ã¼ã«åããã«ã¯é¢æ°ããã°ã©ãã³ã°ã®ã¹ã¿ã¤ã«ã§æ¸ãã¨ãããã é«éé¢æ°ã使ãã¨æã â¦
ååã®æ¨æ§é ã¨åãããã«ãªã¹ãã表ç¾ããã¨ã©ããªãã®ã? def tree = { [:].withDefault{ owner.call() } } def list = { h, t -> [h, { t?.call() }] } ã¡ãã£ã¨æå³ãéãæ°ããããã©æ°æã¡ã®åé¡ã®ç¯å²ãªã®ã§ç¶ããã h ã¯å é ã®è¦ç´ ã§ãt ã¯è©ä¾¡ããâ¦
Groovy ã§ã¯æ¨æ§é ã次ã®å½¢ã§è¡¨ç¾ã§ãããããã def tree = { [:].withDefault{ owner.call() } } def users = tree() users.harold.username = 'hrldcpr' users.yates.username = 'tim' def json = new groovy.json.JsonBuilder(users).toString() assert â¦
O'Reilly ã§ã¯ Open Books ã¨ãã£ã¦ä¸é¨ã®æ¸ç±ãã¾ãã¾ãèªãããããã O'Reilly Open Books Project concurrency ã調ã¹ã¦ãgroovy and concurrency ãè¦ã¦ããã Groovy ã® O'Reilly æ¬ãç®ã«å ¥ãã ããããã°ãã¤ãèªã®æ¬ããã£ããªã¨ãããã¨ã§èª¿ã¹ã¦â¦
Generator ãæã«å ¥ããã®ã§ãåã³ããã³ã°ã®åé¡ã«ææ¦ããã Hamming numbers - Rosetta Code åãããã«å®è£ ããããã«ã¯ itertools ãå¿ è¦ã ã Python documentation ã« Python ã§æ¸ãããä»æ§ãè¼ã£ã¦ããã®ã§ãã®ã¾ã¾å®è£ ããã itertools â Functionsâ¦
ã³ã³ãã¤ã©ããã«æãã¦ããã£ãã def aMethodHasNamedArguments(Map named=[:], Object... args) { println "named=$named, args=$args" } aMethodHasNamedArguments("A", key1:1, "B", key2:2, "C") // named=[key1:1, key2:2], args=[A, B, C] aMethodHaâ¦
åæãã Generator ã java.util.concurrent ããã±ã¼ã¸ã使ã£ã¦æ¸ãã¦ã¿ãã Using BlockingQueue ã¯ããã« http://groovy.codehaus.org/Iterator+Tricks ã®ããã«éåæã®ãã®ã BlockingQueue ã§æ¸ãã¦ã¿ãã def generate(Closure generator) { return â¦
ååã® Closure ãããã£ã¨ç°¡åã«ã§ããã ã¨ããã Python ã¨åãã ã£ãã Python ã¨åãæ¹æ³ org.codehaus.groovy.runtime.ScriptBytecodeAdapter ãã // TODO: set sender class public static Object invokeClosure(Object closure, Object[] argumentsâ¦
Python ã§ã¯ object.__call__ ãå®ç¾©ããã¨ãªãã¸ã§ã¯ããå¼ã³åºããããã ã 3.4.5. Emulating callable objects Scala ã§ã apply ã¡ã½ããã§åãããã«ãªãã¸ã§ã¯ããå¼ã³åºããã¨ãã§ããã Groovy ã§åãããã«ããã«ã¯ã©ãããã°ãããã ããããã®åâ¦
ãé¡ï¼ããéé¡ã«ãªãã³ã¤ã³ã®çµã¿åãã - No Programming, No Life Javaã§ãããéé¡ã«ãªãã³ã¤ã³ã®çµã¿åããã - terazzoã®æ¥è¨ ã Groovy ã«ç¿»è¨³ãããã¨ãããã調ã¹ã¦ããã Tree iterator ãç°¡åããã ã£ãã®ã§å®è£ ãã¦ã¿ã*1ã åè General designâ¦
ãé¡ï¼FizzBuzz(Nãã¿ã¼ã³) - No Programming, No Life fizz buzz without trial division · GitHub ã Groovy ã«ç¿»è¨³ãã¦ã¿ãã @Grab(group='com.google.guava', module='guava', version='r09') import com.google.common.base.Function import static coâ¦
ãµãã¼ã¤ã³ã¿ã¼ã³2011åé¡ | Preferred Research æãã¤ããæ¹æ³ã 解ããã¦ããã¯ãã¼ã¯ããã¦ããæ¹ ã¨éã£ãã®ã§ãååããå¤ãç¾ãããªãæåã®ãã¤ãä½ç½®ãã«ã¦ã³ããã¦ååãã大ãããã¤ãä½ç½®ã ãæ¾ã£ãæåãåºåããã°ããã®ã§ã¯ãªããã¨æã£ãã â¦
0ã1000ã«å«ã¾ãã0ãã«ã¦ã³ããã ã¨ããåé¡ã åè ç·´ç¿ - krystal: ããã°ã©ãã³ã°è¶ åå¿è (æç³») - Rubyist - ãªãªã¸ãã« 0ã1000ã«å«ã¾ãã0ãã«ã¦ã³ããã - http://rubikitch.com/ã«ç§»è»¢ãã¾ãã - Ruby 㧠'0' in 0~1000 - ellaneous - golf 㧠ä»â¦
æåã« Groovy 1.8.1 ããªãªã¼ã¹ããã¾ããã åå Grape ã«ã¤ãã¦æ¸ããã°ããã§ããããã©ã«ãã§ãã¼ã«ã«ã® Maven ãªãã¸ããªãåç §ãããããã«ãªãã¾ããã Maven ãªãã¸ããªãåç §ããè¨å®ã追å ããã ããªãããè¨å®ãã¡ã¤ã«ã¯åé¤ãã¦ãããã§ãã 2â¦
groovysh ã§ã©ã¤ãã©ãªãåç §ãããã£ãã®ã§ Grape ã«ã¤ãã¦èª¿ã¹ãã(Groovy 1.8.0 æç¹) åè http://groovy.codehaus.org/Grape http://groovy.codehaus.org/Japanese+Grape groovy.grape.Grape.grab ã¡ã½ãã ã¹ã¯ãªããã§ä½¿ç¨ãã @Grab ã®ä»£ããã« grooâ¦
diffã®åä½åçãç¥ããã©ã®ããã«ãã¦å·®åãå°ãåºãã®ã ãèªãã§ããããã¶ãæéãçµãããã©ã Diff ã®ã¢ã«ã´ãªãºã ãç解ã§ãã*1ã ç解ããããã«ããããæ¤ç´¢ããã Diff algorithm ã®è§£èª¬ãèªåã«ã¯ãã¡ã°ãåãããããã£ã*2ããã®ã¨ã³ããªããªâ¦
Longest common subsequence - Rosetta Code ã Groovy ã§å®è£ ãã¦ã¿ãã DP 㯠Java çãå帰㯠Haskell çãåèã«ããã Dynamic programming def lcs1(xs, ys) { int N = xs.size() int M = ys.size() int[][] dp = new int[N+1][M+1] for (i in 0..
Java ã® double ã®éæ°ãç¡é大ã®æ¯ãèãã«ã¤ãã¦ã®ã¡ã¢ã æ¯è¼ Groovy ã®ãã°å ±å㧠Doublle.NaN == Double.NaN 㯠false ã¨è©ä¾¡ãããã¹ãã¨ä¸ãã£ã¦ããã http://jira.codehaus.org/browse/GROOVY-4906 Java è¨èªä»æ§ã§ã¯ãããªã£ã¦ãããããã®ã§ç¢ºèªâ¦
ãããã³ç¬¦å·ã¯ãã¼ã¿å§ç¸®ã®ææ³ã§ ãããã°ã©ãã³ã°ã³ã³ãã¹ããã£ã¬ã³ã¸ããã¯ã ã«ããã¨è²ªæ¬²æ³ã«ãªããããã åºç¾é »åº¦ãé«ãæåã«ããçã符å·ãå²ãå½ã¦ãã®ã§å ã®æååããå§ç¸®ã§ããã ã¨ã³ã³ã¼ãã®æé æååããé »åº¦è¡¨ãä½æãã é »åº¦è¡¨ãããâ¦
id:akihiro4chawon æ°ã® æ¯è¼ã¯ã¢ãã¤ã ãèªãã§æ°ããè¦ç¹ãå¾ãããæ°ãããã®ã§å¿ããªããã¡ã«æ¸ãã¦ããã å群ã¨ã¯ Wikipedia ããå¼ç¨ æ¼ç®ãéãã¦ãã S ã®åå a, b ã«å¯¾ãã¦ãæ¼ç®çµæ a ⢠b ã¯åã³ S ã«å±ããã çµåå¾ S ã®åå a, b, c ã«å¯¾ãâ¦
Groovy Sequence of a number - Stack Overflow ãã def number = 169 // need a method in groovy to find the consecutive numbers that is, 1,6,9,16,69,169 // not 19! Groovy ã«ã¯ List#subsequences ããããã©ãããé£ç¶ãã¦ãããã®ã ã欲ããããâ¦
çµãã£ã¦ããã© ãããã°ã©ãã³ã°Groovyãã®ã«ãã¼ã«è¼ããçãããã°ã©ã - Togetter ã¿ã¦èãããã®ã ãããã°ã©ãã³ã°GROOVYãã¨è¡¨ç¤ºããããã°ã©ã ãç¡è¶ãª 3 è¡ã ã£ãã®ã§ãããã«ããã æ¬å½ã¯ Groovy ã®ãã´ãã©ããã® API ã§ã¢ã¹ãã¼ã¢ã¼ãã«å¤æãâ¦
inamori æ°ã® ãã確ç - æ¡ã®å¤©ç¶æ°´ ãå®è£ ãã¦ã¿ã*1ã 8ã¤ã®ã³ããããã£ã¦ããã¼ã«ãã©ã³ãã ã«16åã³ããã«å ¥ããã ãã®ã¨ãå ¨ã¦ã®ã³ããã«2åãã¤ãã¼ã«ãå ¥ã確çã¯ï¼ ãã¼ã«ãå ¥ããã³ããã§ã«ã¼ããã ã©ã®ã³ããã«å ¥ãããã§å¦çãã㨠8^16 åå¦â¦