2009-05-01ãã1ã¶æéã®è¨äºä¸è¦§
2016/08/11 è¿½è¨ Java ã¢ãã¬ããã¨èªå® ãµã¼ããæ» ã³ãã®ã§ãAndroid ã¢ããªã¨ãã¦ä½ãç´ãã¾ãããhttps://play.google.com/store/apps/details?id=io.github.mame.flagir å½æãæãã¦æ¤ç´¢ããã¢ãã¬ããã§ããå½é競æã®è¦³æ¦ãªã©ã®ãä¾ã«ã©ããã ref: htâ¦
zip 㨠map ã§ç°¡åã«å®è£ ã§ããã°ã¾ãããããªã¨æã£ããã ãã©ã val xs = List(1, 2, 3) val ys = List(4, 5, 6) xs zip ys map { (x, y) => x + y } // error: wrong number of parameters; expected = 1ãããã¼ãå¼æ°ã n ååãåãé¢æ°ã¨ n-tuple ã â¦
ä¹ ã ã«ã¡ããããã¨ãããã¨ã§ä¸¸ãå ç·ãã¾ãã¯æ¯ç·ã®æ¹åçºé§ ããä¸éåä¸é§ ã¾ã§ãç·è·¯ã®è·é¢ã§ 3.2 km ãæ©ãã®è·é¢ã§ 3.9 km ãæ¹åçºé§ ãªãã¦åãã¦è¡ã£ããããè¡ãæ©ä¼ããªãããªããããã£ã¦æ®éã®ååºè¡ã ã£ãã丸ãå ç·ã®ä¸éæ¤è»åºã®æ¨ªãéã£ã¦ãâ¦
n,m=$* w=m.size i=n.size f=proc{| *a|a.map{|s|s.to_s.rjust w+i+1}};a=f[n.to_i/d=m.to_i, s="-"*i,m+")"+n];t=i=0;n.chars{|c|s<<45;w+=1;s,a="-"* t.to_s.size,a+f[s,t,t-t%=d]if(t=t*10+c.to_i)/d>0};;a[ #Y.Endoh 3,2]=[]; puts a + f[s,t] $ ruby19 â¦
å é±ã®ç¶ãã§ãæããªãé§ ããã¤ãã°é§ ã¾ã§ã7 æãã 16 æã¾ã§ãç·è·¯ã®è·é¢ã§ 26.3 km ãæ©ãã®è·é¢ã§ 37.2 km ãå é±ã®çµäºå°ç¹ã§ããæããªãé§ ãããç·è·¯ã¯å©æ ¹å·ã渡ã£ã¦æ»ããã«å®è°·é§ ã«åããããã©ã人éã¯æ¸¡ããªãã®ã§ã3 km ã»ã©ä¸æµã®æ©ã¾ã§è¿åâ¦
è³æ: http://www.scala-lang.org/docu/files/ScalaByExample.pdf 9. Lists ãªã¹ãã®ä½ãæ¹ã val fruit = List("apples", "oranges", "pears") val nums = List(1, 2, 3, 4) val diag3 = List(List(1, 0, 0), List(0, 1, 0), List(0, 0, 1)) val empty = Liâ¦
è³æ: http://www.scala-lang.org/docu/files/ScalaByExample.pdf 5. First-Class Functions é¢æ°ããã¡ã¼ã¹ãã¯ã©ã¹ãªè©±ã 5.1 Anonymous Functions ãã§ã«åºã¦ããã¨æããã© (x: Int) => x * x ãå¿åé¢æ°ãInt åã®å¼æ°ã 1 ã¤åãåã£ã¦ãäºä¹ãè¿ããâ¦
ref: http://d.hatena.ne.jp/kmizushima/20090513/1242218451 ã¿ããã¾ããã«ããããæãã¦ããã£ã¦ãã¾ãã¾ããããããã¨ããããã¾ãããªãã§ãæãã¦ã¿ãããã§ããã static ã¡ã½ããã¨æ®éã®ã¡ã½ãããæ··ãã£ã¦ãã¯ã©ã¹ã¯è¡¨ç¾ã§ããã®ãããã staticâ¦
Scala By Example ãèªã¿ã¾ããè³æ: http://www.scala-lang.org/docu/files/ScalaByExample.pdf 1. Introduction ããã¨ãã ãããã 2. A First Example imperative ã«æ¸ããã¯ã¤ãã¯ã½ã¼ãã®ä¾ã def sort(xs: Array[Int]) { def swap(i: Int, j: Int) { â¦
Scala ãåå¼·ãã¦ã¿ã¾ãã売ãæå¥ã ãè¦ã¦ã¿ã㨠1. æç¶ãåã§ãé¢æ°åã§ãæ¸ãã 2. ç´ç²ãªãªãã¸ã§ã¯ãæå 3. æè»ãªææ³ã§ DSL ãããã 4. ãã¿ã¼ã³ããã 5. éçåä»ã (ã¸ã§ããªã¯ã¹ãã) 6. JVM ã§åã (Java ã®è³ç£ãæ´»ç¨ã§ãã) 1 ã 3 㯠Rubyâ¦
[[1, 2], [3, 4], [5, 6]] ã¨ããé åãã {1=>2, 3=>4, 5=>6} ãä½ãç°¡åãªæ¹æ³ããªãã¨ããã®ã¯ãããã¨ããåºã話é¡ã§ãããã1.9 ã§ã¯å®ã¯ Hash#[] ã¨ãã¦å®è£ ããã¦ãã¾ãã (ruby-core:23225) ã Hash[[[1, 2], [3, 4], [5, 6]]] #=> {1=>2, 3=>4, 5=>â¦
ã¤ãã°ã¨ã¯ã¹ãã¬ã¹ (TX) ãååæ©ãã¾ãããç§èåé§ ããæããªãé§ ã¾ã§ã7 æåãã 18 æã¾ã§ãç·è·¯ã®è·é¢ã§ 32.0 km ãæ©ãã®è·é¢ã§ 43.3 km ãã¿ããªå¤§å¥½ãç§èåé§ ããã¹ã¿ã¼ããTX ã¯æ¹æã®åçãæ®ãã«ã¼ã«ã«ããã®ã§ãä¸å¿æ¹æã¾ã§å°ä¸ã«ãããã â¦
1 æ¥ä¼ã㧠(ã¨ãã£ã¦ãååé§ è¦å¦ããã横å·é§ ã§ã¢ããã®éãæ©ããããã¦ããã®ã ããã©) ã5/3 (æ¥) ã«ä¸è¶ç·ã®ç¶ããé«å´é§ ã¾ã§æ©ãçµãã¾ããã8 æåãã 17 æåã¾ã§ãç·è·¯ã®è·é¢ã§ 30.5 km ãæ©ãã®è·é¢ã§ 35.8 km ãæ´¥ä¹ ç°é§ ããã¹ã¿ã¼ããå±±ã®ç°èâ¦
ç¶ã㦠5/1 (é) ã«ãä¸è¶ç·ã® Suica åºéå端ã§ããæ°´ä¸é§ ãããæ´¥ä¹ ç°é§ ã¾ã§æ©ãã¾ããã9 æãã 18 æåã¾ã§ãç·è·¯ã®è·é¢ã§ 28.5 km ãæ©ãã®è·é¢ã§ 32.9 km ãæ°´ä¸é§ ã¯æ°´ä¸æ¸©æ³ã§ããã¨æåããã®å¤ªãå©æ ¹å·ã§ããããã¾ã§ä¸æµã«ãªãã¨å¤å°ã¯ç´°ãããã§â¦
GW ã ã£ãã®ã§ãæ³ãããã§æ©ãã4/30 (æ¨) ã«ã¯ä¿¡è¶æ¬ç·ãæ©ãã¾ããã横å·é§ ããé«å´é§ ã¾ã§ã8 æåãã 17 æåã¾ã§ãç·è·¯ã®è·é¢ã§ 29.7 km ãæ©ãã®è·é¢ã§ 32.8 km ã3 æã« Suica ç¯å²ã«ãªã£ãã°ããã®ä¿¡è¶æ¬ç·ãå§çºã«ä¹ã£ãã¨ã¯è¨ãã横å·é§ ã« 8 æéâ¦