2007-01-01ãã1å¹´éã®è¨äºä¸è¦§
ref: http://mono.kmc.gr.jp/~yhara/d/?date=20071229#p01 C + setjmp + longjmp 㧠amb ãå®è£ ã§ãããã¨ãã話é¡ãCPS å¤æããã°ã§ãããã§ããã©ãCPS å¤æããã° setjmp + longjmp ããªãã¦ãã§ããã *1 ã§é¢ç½ããªãã®ã§ãç¡çç¢ç以ä¸ãåãããã«æ¸â¦
IRC ã® %ruby ã§ããã¨ããã¨è¨ããã¾ããã1981 å¹´ç 26 æ³ã®ãããã *1 ã ããéããã¨æã£ããã§ãããwikipedia ã®è§£èª¬ã«ããã¨åºç¾©ã®ãã¨ãä¸ä»£ã¿ããã§ããã1980 å¹´ãã段éçã«æ½è¡ãã¦ãããããã®ã§ãç義ã®ãã¨ãä¸ä»£ã¯ 1987 年以éçã¾ãã®ããâ¦
ä»å¹´ã®ã¾ã¨ãã ã¦ã©ã¼ãã³ã°ãå§ãããæåã«æ©ããã®ã¯å±±æç·ã§ããã®çç±ã¯ãå¤ 7 æããæ¸è°·ã§é£²ã¿ä¼ããããããæ 7 æã«è¡ã£ã¦ä¸å¨ããã (?)ãã¨ãã話ã«ãªã£ãããã§ããå®éã«ã¯æèµ·ãããªã㦠9 æé ã¹ã¿ã¼ãã«ãªã£ãä¸ã飲ã¿ä¼ã«ã 5 åã»ã©é å»â¦
以å left 㨠right ã®ã©ã£ã¡ãã©ã£ã¡ãããããªããªãç æ£è ã§ãããã¨ãã«ãã³ã°ã¢ã¦ããã¾ããããå®ã¯ãã£ã¡ã®ç æ°ã§ãããã¾ãããã®ç æ°ã®åå ãèãã¦ã¿ãã®ã§ãããããã¯ééããªããã¿ããã¨ãã²ã ããã¨ã®é³ã®é¡ä¼¼ã®ããã«éããªãã§ãããã¼ãåâ¦
å é±ã®åææ¥ã¯ãã¾ã天æ°ããããªãã£ãã®ã§ãæå¾ åº¦ãä½ãã¦çãã®å°ä¸éããé½å¶æµ èç·ãé¸ãã§æ©ãã¾ããã西馬込ãããæ³å²³å¯ºãæ°æ©ãé座ãæµ èãéã£ã¦æ¼ä¸ã¾ã§ãç·è·¯ã®è·é¢ã§ 18.4 km ãæ©è¡è·é¢ã§ 23.3 km ãæè¦æé㯠9 æãã 17 æã¾ã§ã® 8 æâ¦
ãã 1 é±éãåã®è©±ã§ãããOCaml-Nagoya ã®äººãã¡ã ocaml.jp ã®ç®¡ç人ãªã©ã¨é£²ã¿ä¼ã§ãããå 容ãç§å¯æ å ±ãªã®ãå ¬éæ å ±ãªã®ã確èªããªãã£ãã®ã§ã©ãã¾ã§èªã£ã¦è¯ãã®ããããã¾ããããã¨ããããè¿ããã¡ã«æ¥æ¬ã® OCaml ã³ãã¥ããã£ãå éãããããªâ¦
ãã¤ã³ã¿ã®ãªã C è¨èª *1 ã¯ãã¥ã¼ãªã³ã°å®å ¨ã§ãããããæ¨æ¥ã¯é äºããã¨ã®è©±ã§ ã§ã¯ pointer-free 㪠C è¨èªã¯ã©ãããã¨èãã¦ã¿ã¾ããããunion ã§ãªãã¨ãã§ãããã¨ã®è¿äºã ã¨æ¸ãã¾ããããunion ã¯åå¤æãã§ããã ãã§ãã¤ã³ã¿ãåãåºããã¨ã¯â¦
é äºãããbrainfuck ãå®è£ ãã¦ããã¾ããããããã¨ããããã¾ããã§ã¯ pointer-free 㪠C è¨èªã¯ã©ãããã¨èãã¦ã¿ã¾ããããunion ã§ãªãã¨ãã§ãããã¨ã®è¿äºããã£ãã¼ãã¡ãªã¿ã«å è¨äºã§å帰ã¨æ¸ããæã¯ããlambda è¨ç®ãã¨ã³ã³ã¼ãã§ããããªã¼ãâ¦
FlashPlayer ãã¹ã¿ãã¯ãªã¼ãã¼ããã¼ããããã¨ãã§ããä»æ§ (?) ãæªã ã«ç´ãã¾ãããAdobe ã«å ±åãã¦ããåå¹´è¿ãã«ãªãã¾ãããããããªãã®ã§ 10 ææ«ã« IPA ã®ã»ãã¥ãªãã£ã»ã³ã¿ã¼ã«å ±åãã¦ã¿ãã®ã§ããã1 ã¶æåå¾ ãããããããããã¹ã¿ãã¯ãªâ¦
ã¤ãã§ã«ãååéä¼ã§ä¹ããªãã£ãä¸éåç©åã®ã¢ãã¬ã¼ã«ã«è¡ãã¾ããã14 æ 25 åã«ä¸éåç©å西åé§ ãåºçºãããªãªã¢ãªã¯ã¤ãã¨ãã¥ã¼ãã¿ã¤ã¤ã14 æ 34 åã«ä¸éåç©åæ±åé§ å°çãç·è·¯ã®è·é¢ã§ 331.42 m (0.3 km) ãéã®ãã§ã¯å¤å 400 m å¼±ã ã¨æãâ¦
æ¨æ¥ã¯äº¬æ¥æ¬ç·ãæå¾ã¾ã§æ©ãã¾ããã京æ¥å·å´ããåå·ãã¤ãã§ã«æ³å²³å¯ºã¾ã§ãç·è·¯ã®è·é¢ã§ 13.0 km ãæ©è¡è·é¢ã§ 16.0 km ãæè¦æéã¯æ 7 æããæ¼ 12 æã¾ã§ã®ç´ 5 æéã風éªã®ç ã¿ä¸ãããªã®ã§å°ãªããè¦æã¯å¤§æ£®æµ·å²¸é§ è¿ãã®é´ã¶æ£®åå ´éºè·¡ã¨ãã¨ãâ¦
ä»æ¥ã¯äº¬æ¥æ¬ç·ã®ç¶ããæ©ãã¾ãããéæ²¢å «æ¯ãã京æ¥å·å´ã¾ã§ãç·è·¯ã®è·é¢ã§ 29.1 km ãæ©è¡è·é¢ã§ 35.8 km ãæè¦æéã¯æ 8 æããå¤ 6 æã¾ã§ã®ç´ 10 æéã京æ¥ã¯é§ éãçãã®ã§ãä»æ¥ã ã㧠25 é§ ã«çãã¾ãããç¹ã«æ¨ªæµããåãé¡èã§ãå¾æ© 10 åãâ¦
ä»æ¥ã®çåãC è¨èªãã malloc ã calloc ãªã©åçã«ã¡ã¢ãªã確ä¿ããæ段ãçãã¦ãããã¥ã¼ãªã³ã°å®å ¨æ§ã¯ä¿ãããã®ã§ãããããå帰ããã¾ã使ãã°ã§ããã®ããªã
é çªã¯ã©ãå¤ãã¦ããããããã¨ã«ãããã©ã®è¦ç´ ããã¤ãã¯åºã¦ããï¼æéã¹ããã以å ã«ã¯åºã¦ããï¼ãããã«åæãããªã¹ããè¿ãé¢æ°ãä½ã£ã¦ã¿ã¦ãã ããã ç¡éãªãç¡é ä½ãè¨åã«è£ã®æå³ããããããªæ°é ãæãã¾ããããã£ããé£ããã¾ããç¡éãªâ¦
æè¿ä½ãã¨è©±é¡ã®ãã£ããããæ°è¨ç®ã®é«éåã§ããã F(n) = (fib(n+1), fib(n)) ï¼2次å ã®ç¸¦ãã¯ãã«ã ã表è¨ã®é½åã§æ¨ªã«æ¸ãï¼ A = ((1, 1), (1, 0)) ï¼ç¬¬1è¡ã(1, 1)ã§ç¬¬2è¡ã(1, 0)ã®è¡åï¼ ããã¨ï¼F(n) = A F(n-1) = A A F(n-2) = A A A F(n-3) = ..â¦
ç¾å¨ã®ã¤ãã¬ã¼ã¿ã®åæ°ãè¿ãçµã¿è¾¼ã¿å¤æ°ã¨ãã®æ¹ãå¬ãããã§ãã ã試ãã«å®è£ ãã¦ã¿ã¾ããã 3.times { p $# } %w(a b c).each {|x| p [x, $#] } $ ./ruby foo.rb 0 1 2 ["a", 0] ["b", 1] ["c", 2]3.times do i = $# 3.times { p [i, $#] } end $ ./ruâ¦
éææ¥ã«ãæ±äº¬é½äº¤éå±ä¸éæ¸åç·ãæ©ãã«è¡ã£ã¦ãã¾ãããå¹³ããè¨ãã¨ä¸éåç©åã®ã¢ãã¬ã¼ã«ã§ããwikipedia ã®ã¨ã³ããªã«ããã¨ãæ£å¼ãªééãããã§ããä¸éåç©å西åé§ ããä¸éåç©åæ±åé§ ã¾ã§ã14 æ 13 åãã 14 æ 18 åã¾ã§ã®ç´ 5 åãç·è·¯ã®â¦
1.9 ã§ã¯ Enumerator ãçµã¿è¾¼ã¿ã«ãªãã大ããæ¡å¼µããã¦ãã¾ããã¤ãã§ã«ãããã¯ã®çç¥ã«å¯¾ããèãæ¹ã«ãå½±é¿ãããã¾ããçµæ§é大ãªå¤æ´ã®ããã«ããã®è©±ã¯ãã¾ãè°è«ãå¨ç¥ãããã¦ããªããããªæ°ãããã®ã§ãç¾ç¶ã® Enumerator ã«ã¤ãã¦ããã®æ©è½ã¨â¦
大ããã®ã³ã³ã½ã¼ã«ã§å®è¡ãã¦ãã ããã W, H = 44, 54 c = 7 + 42 * W a = [0] * W * H g = d = 0 f = proc do |n| a[c] += 1 o = a.map {|z| " :#"[z, 1] * 2 }.join.scan(/.{#{W * 2}}/) puts "\f" + o.map {|l| l.rstrip }.join("\n") sleep 0.005 d +=â¦
PEG æè¦äº¤æä¼ã«åå ã§ããªãã¦æããã®ã§ãRuby ã§æ¸ãã PEG ã®å®è£ ãæãã¾ããhttp://dame.dyndns.org/misc/misc/rpeg-20071125.zip å ¥å㯠Pappy 風ã®è¨èªã§ããä¸ã¯ PEG ã®ãã¼ãµã PEG ã§æ¸ãããã® (rpeg.rpeg) ã§ãã parser RPegParser: { requirâ¦
http://www.rakuten.co.jp/event/10th/tech/conference/index.html ãè¦ãã¦ãã¾ãããä»åã¯ç¬¬ä¸åã¨è¨ããã¨ã§ãå¾®å¦ãªç¹ã¯ããã¾ãããæè¡è·åãã®çºè¡¨ã¨å¶æ¥è·åãã®çºè¡¨ãæ··ãã£ã¦ãã¦è´è¬ãã«ããã£ãã¨ãã質çå¿çããªãã¦æ®å¿µã¨ããã§ãã楽天ã®äººâ¦
ä»æ¥ã¯éæ¢ ç·ã®ç¶ãã¨ãäºæ¥å¸ç·ãæ©ãã¦ãã¾ãããã¤ãã§ã«äºæ¥å¸ç·ã®å»ç·é¨åãæ©ãã¾ãããå»ç·é¨å㯠(å ) æ¦èµå²©äºé§ ããå¤§ä¹ éé§ çµç±ã§æ¦èµäºæ¥å¸é§ ã¾ã§ã§ã8 æåéããã 9 æéãã¾ã§ã®ç´ 30 åãå½æã®ç·è·¯ã®è·é¢ã¯ 2.7 km ã§ãããåå²é¨åã¯å¾åâ¦
åå Array#tail ãææ¡ããã¨ãããé (head)以å¤ã¯å ¨é¨å°»å°¾(tail)ã£ã¦ã®ã¯ãååãããã¨è¨ããã¦åãã¦ãtail ã¨ããååãä¸èªç¶ãªãã¨ã«ä½ã®çåãæã£ã¦ããªãã£ãèªåã«æ°ãã¤ãã¾ããããªã¹ãã®å é ã¨å é 以å¤ã head/tail ã¨è¨ãã®ã¯ãã¤ãããããªâ¦
ç´ èã®å£ç¯ãªã®ã§ãåææ¥ã«å¥¥å¤æ©ã«è¡ã£ã¦ãã¾ããããã®ã¤ãã§ã«éæ¢ ç·ãæ©ãã¦ãã¾ããã奥å¤æ©ããå°ä½ã¾ã§ãç·è·¯ã®è·é¢ã§ 23.1 km ãéã®ã㧠27.2 km ã§ãããæ 9 æåããå¤ 18 æåã¾ã§ç´ 9 æéãå ¨é¨ä¸ããªã®ã§ä½åçãªåé¡ã¯ãªãã£ãã®ã§ãããâ¦
ary.drop(1) ã§ããããã¨ããè¡æççµæ«ããé¨ãããã¾ãããã¨ãã㧠take/drop ã£ã¦ååã¯ã©ããªãã§ãããããdrop ã¯ãé ããè½ã¨ãã¨ã¯ããããªãããè½ã¨ããé ãè¿ãã®ããè½ã¨ãããä½ãè¿ãã®ããææ§ãªæãããã¨ãªãã¨ãªãç ´å£çã¡ã½ããã®å°è±¡â¦
ã¯ã¦ãªã®ãªã³ã¯å ä¸è¦§ã£ã¦ Google ã¨ãã®ãªã³ã¯ãã»ã¼ãã®ã¾ã¾æãã¦ã¦è¦ã«ãããªã¼ã¨æã£ãã®ã§ãããã¯ãã¼ã¯ã¬ãããæ¸ãã¾ããã ç·¨éç»é¢ãéãã¦å®è¡ãã㨠Google 㨠Yahoo ã¨ã¯ã¦ãªããã®ãªã³ã¯å ãçã表示ãã¾ããä¾ãã°ããhttp://www.google.co.â¦
åã¯ãã®ç æ°ã®æ«ææ£è ã§ããleft 㨠right ãã©ã£ã¡ãã©ã£ã¡ãèãåºãã¨æ°ç§ããªã¼ãºãã¾ããæ¥æ¬èªã®å³ã¨å·¦ã§ã¯ããã¾ã§ã²ã©ããªã (ã§ãæ ¢æ§çã«è»½åº¦ã®çç¶ã¯ãã) ã®ã§ãããè±èªã«ãªãã¨ç¹ã«é篤ã§ããä¾ãã° æ°å¹´åã® ICFP Contest ã§ã¯ãã¢ãªã®åãâ¦
Array#flatten ã¯é åããããã¡ã½ããã§ãã ary = [ [1], [2, [3], 4], [5] ] p ary.flatten #=> [1, 2, 3, 4, 5] ãã®ã¡ã½ããã¯ä¾¿å©ã«è¦ãã¦ãé常ã«ã¯ã¾ããããã¡ã½ããã§ãããã®ã¡ã½ããã¯ããã¿ããããã§ããä¸ã§è¨ãã¨ã[1, 2, [3], 4, 5] ãè¿ãâ¦
i = i + 1 ã i += 1 ã¨æ¸ããã®ã ãã x = x.add(1) ã x .= add(1) ã¨æ¸ãã¦ãããã®ã§ã¯ãªãã (åèª) ãããã operator= ãå°å ¥ãããã¿ããã«è¦ããããªã
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/44186 ãè¦ãã«è¡ãã¾ãã楽天ã¨ãå ¨ãç¥ããªãã®ã« (ç¬)