¥È¥Ã¥× «Á°¤ÎÆüµ­(2008-06-27) ºÇ¿· ¼¡¤ÎÆüµ­(2008-06-29)» ÊÔ½¸

¤Ï¤¸¤á¤Æ¤Î¤Ë¤­

¤³¤³¤Î°ÌÃÖÉÕ¤±

2004|11|
2005|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|03|04|05|06|07|08|09|10|11|

ToDo:


2008-06-28

_ Perl5VM Golf

µ¤¤Ë¤Ê¤Ã¤Æ¤¿¤Î¤Ç¥Ë¥³¥Ë¥³¤Ç¸«¤¿¡£

http://d.hatena.ne.jp/tokuhirom/20080623/1214220971

¤¦¡¼¤óÌÌÇò¤¤¤È»×¤¦¤±¤É¡¢¥ì¥®¥å¥ì¡¼¥·¥ç¥ó¤¬Èù̯¤«¤Ê¤¡¡Ä

¤Ê¤ó¤« perl ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë°Í¸¤·¤Æ¤ë¤Î¤¬¤Í¡Ä ¤¦¤Á¤Î 5.10.0 ¤À¤È

> perl -MAcme::PerlVMGolf -e '1/!!!!1'
hit: 5op(const, constant item)
hit: 96op(not, not)
hit: 5op(const, constant item)
hit: 96op(not, not)
hit: 5op(const, constant item)
hit: 96op(not, not)
hit: 5op(const, constant item)
hit: 96op(not, not)
hit: 5op(const, constant item)
hit: 5op(const, constant item)
hit: 57op(divide, division (/))
hit: 180op(enter, block entry)
hit: 177op(nextstate, next statement)
hit: 181op(leave, block exit)
Your perl is : 5.10.0
Your score is : 1009op

¤È¤º¤ì¤ë¤Î¤è¤Í¡£ YARV ¤â instruction ÊѤï¤Ã¤¿¤ê¤¹¤ë¤·Æñ¤·¤¤¤ó¤¸¤ã¤Ê¤¤¤«¤Ê¤¡¡£

ÁÇľ¤Ë op code ¥µ¥¤¥º½Ì¤á¤ê¤ã¤¤¤¤µ¤¤¬¤¹¤ë¤ó¤À¤±¤É¡¢ ¤¿¤Ö¤ó¥¹¥¿¥Ã¥¯¥Þ¥·¥ó¤Î VM ¥´¥ë¥Õ¤È¤«¤½¤ó¤Ê¤ËÌÌÇò¤¯¤â¤Ê¤¤¤ó¤À¤í¤¦¤Ê¡£ ¤Á¤ç¤¦¤É¤òÌܻؤ¹¤Î¤¬¥ê¥¢¥ë¥´¥ë¥Õ´¶¤¬¤¢¤ë¤È¤¤¤¨¤Ð¤¢¤ë¤·¡£

(01:11)

_ ¤¦¡¼¤ó

¤·¤ó¤É¤¤

(01:22)

_ ¤·¤ó¤É¤¤

µ¯¤­¤¿¤é¤¢¤í¤ÏÀèÀ¸¤¬Ãý¤Ã¤Æ¤¿¤Î¤Ç¸«¤Æ¤¿¡£

gccint.info ¤ò狼Ìõ¤¹¤È¤¤¤¤¤È»×¤¦¤ó¤À¤è¤Í¡£ ¤¢¤È gcc wiki ¤Î internal ¤Ê¤ó¤Á¤ã¤é¤È¤«¤¢¤Î¤Ø¤ó¡£

¤·¤ó¤É¤¤¤Î¤Ç¤³¤ó¤Ê¥³¡¼¥É¤ò½ñ¤¤¤Æ¤¿¡£

int main() {
    int p = 1;
    if (p > 0) {
        int p = printf("%d\n", p);
    }
}

¶Ã¤¤¤¿¡£¤³¤ì 0 ¤Ã¤Æ½ÐÎϤµ¤ì¤¿¤ó¤À¤¼¡Ä!

(19:06)

_ ¤Õ¤È»×¤Ã¤¿

Array#step Íߤ·¤¯¤Í¡£ ¤Ê¤ó¤«½ÐÎÏŬÅö¤Ë¤ä¤Ã¤Æ

hoge fuga
30 20 40 50
foo bar
10 30 20 40
...

¤ß¤¿¤¤¤Ê´¶¤¸¤Ç½ÐÎϤ·¤Á¤ã¤¦¤³¤È¤¬·ë¹½¤¢¤ë¤ó¤À¤±¤É¡¢ ¤³¤ì¤ò¥Ñ¡¼¥¹¤¹¤ë¤Î¤Ï°Õ³°¤È¤á¤ó¤É¤¯¤Æ¤¦¤¶¤¤¡£

¤³¤¦¤¤¤¦¤Î¤¬¤¢¤ë¤È¤¹¤Ã¤­¤ê¡£

class Array
  def step(n, &pr)
    i = 0
    while true
      a = self[i, n]
      break if a.size != n
      i += n
      pr[*a]
    end
  end
end

File.read('log').split.step(6) do |s1, s2, n1, n2, n3, n4|
  puts "#{n1}"
end

(21:07)

_ top10¤ò»Ä¤¹¥Ç¡¼¥¿¹½Â¤

¤Ã¤Æ¤É¤¦¤¹¤ë¤Î¤¬¤¤¤¤¤Î¤«¤Ê¤È¤Õ¤È¹Í¤¨¤¿¡£

°ìÈÖÅÀ¿ôÄ㤤¤Î¤¬¥È¥Ã¥×¤ËÍè¤ë¤è¤¦¤Ë¥Ò¡¼¥×¤òºî¤Ã¤Æ¤ª¤¤¤Æ¡¢ ¤½¤ÎÅÀ¿ô°ìÈÖÄ㤤¥ä¥Ä¤è¤êÂ礭¤±¤ì¤Ð °ìÈÖ¾å¼è¤ê½ü¤­¤Ä¤Ä¿·¤·¤¤Í×ÁǤòÁÞÆþ¡¢ ¤È¤«¤¹¤ë¤Î¤¬Îɤµ¤½¤¦¤Ë»×¤Ã¤¿¡£

ÅÀ¿ôÄ㤤¤Î¤¬¥È¥Ã¥×¤ËÍè¤ë¤¢¤¿¤ê priority queue ¤È¤·¤Æ¤Ï¤Á¤ç¤Ã¤ÈÌÌÇò¤¤¤è¤¦¤Ê¡£

¤Þ¤¡¤¿¤¤¤Æ¤¤¤Ï map ¤«¤Ê¤ó¤«¤ËŬÅö¤Ë¤Ä¤Ã¤³¤ß¤Þ¤¯¤Ã¤Æ ¾å°Ì¤Ê¤á¤ë¤À¤±¤Ç¤¦¤Þ¤¯¤¤¤¯¤ó¤À¤±¤É¤Ê¡¼¡£

(21:21)

_ ¤í¡¼¤°¤é¤¤¤¯

¥ê¥¹¥¯ÈȤ¹¤Û¤É¤Î¥ê¥¿¡¼¥ó¤¬´ðËÜŪ¤Ë̵¤¤¤Ã¤ÆÏä¬ ¤¢¤ë¤ó¤¸¤ã¤Ê¤¤¤«¤Ê¡£ ËͤÎÃΤëÈÏ°Ï¤Ç¤Ï¥í¡¼¥°¥é¥¤¥¯¤Ç¸À¤¦¥ê¥¹¥¯¤Ã¤Æ¤Î¤Ï»à¤Ç¡¢ ¤½¤Î¾ì¹ç¤Î¥ê¥¿¡¼¥ó¤Æ¤É¤¦¤»¤½¤Î¾ì¤ÇÀ¸¤­¤Î¤Ó¤é¤ì¤ë¡¢ ¤À¤±¤Ê¤ó¤À¤è¤Ê¡£ ÌÀ¤é¤«¤Ë¥ê¥¹¥¯¤Ë¸«¹ç¤ï¤ó¡£

̵Íý¤Ë¤½¤ì°Ê³°¤Î¥ê¥¹¥¯¥ê¥¿¡¼¥ó¤È¤«¹Í¤¨¤ë¤È¡Ä ¥·¥ì¥ó¤Ç¥ì¥Ù¥ë¾å¤¬¤Ã¤Á¤ã¤Ã¤¿Å¨¤¬¤¤¤Æ¡¢ º£¼«Ê¬³¬ÃʤȤ³¤Ë¤¤¤ë¤«¤éƨ¤²¤é¤ì¤ë¤±¤É ¼ê»ý¤Á¤Î¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ð¤½¤¤¤Ä¤òÅݤ»¤Æ¥ì¥Ù¥ë¤¬¤¿¤¯¤µ¤ó¾å¤¬¤ë¤È¤«¡Ä ¤½¤ì¤Ï¥ê¥¹¥¯¥ê¥¿¡¼¥ó¤È¤¤¤¦¤è¤êñ¤Ë»ÆÀ´ªÄê¤À¤Ê¡£

¤¦¡¼¤ó¡£¤¿¤Ö¤óÂç¾æÉפÀ¤í¤¦¤±¤ÉËü¤¬°ì¤¬¤¢¤ê¤½¤¦¤ÊÅ¥ËÀ¤È¤«¤«¤Í¡£

(22:14)

_ priority_queue

¤³¤ì priority_queue_map ¤È¤«¤¬¤¢¤ë¤Ù¤­¤Ê¤ó¤¸¤ã¤Ê¤¤¤«¤Ê¤È¤ª¤â¤Ã¤¿¡£

(22:53)

_ watch ¥³¥Þ¥ó¥É

¤Ã¤ÆÃΤäƤޤ¹¤«¡£ tee ¤È¤« tail -f ¤È¤«¤Èʤ־õÂÖ´Æ»ë¥Ä¡¼¥ë¤Ê¤ó¤À¤±¤É¡¢ ¤Þ¤¡¤½¤ì¤é¤Èʤ֤Ȥ¤¤¦»þÅÀ¤Ç¤½¤ó¤Ê¤Ë»È¤ï¤Ê¤¤¡£

¤Ç¡¢¤½¤ì¤È¤Ï¤¢¤ó¤Þ´Ø·¸¤Ê¤¯¤Æ¡¢

diff -u results/18 results/19 L

Ū¤Ê¤³¤È¤ò¤è¤¯¤¹¤ë (L ¤Ï |&lv) ¤ï¤±¤À¤±¤É¡¢ ¤³¤ì¤ò¸«¤Æ¤ëºÇÃæ¤Ë results/19 ¤Ï ¹¹¿·Ãæ¤À¤Ã¤¿¤ê¤¹¤ë¤È¡¢ ¤â¤¦°ìÅÙ¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Æº£¤Î¾õÂÖ¤¬¸«¤¿¤¤¡Ä ¤È»×¤¦¤Î¤Ï¤Þ¤¡¼«Á³¤Ê¤³¤È¤«¤È»×¤¦¡£

¤Ç¤³¤ì¤¬ R ¤Ç¤Ç¤­¤Ê¤¤¤Î¤¬Ê¢¤¬¤¿¤Ä¡£ ̵ÏÀ q ^p ^m ¤È¤«¤Ç¤â¤¤¤¤¤ó¤À¤±¤É¡¢ ¤³¤ì¤À¤È¥«¡¼¥½¥ë¤¬ºÇ½é¤ËÌá¤Ã¤Á¤ã¤¦¡£

unix pipe ¤ÏÍ£°ìÀ®¸ù¤·¤¿¥³¥ó¥Ý¡¼¥Í¥ó¥È¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤À¤È¤«¤¤¤¦ Rob Pike ¤ÎÀµµ¤¤«¤É¤¦¤«¤è¤¯¤ï¤«¤é¤ó¼çÄ¥¤Ï¤³¤¦¡¢ Ⱦ¤Ð»¿À®¤¹¤ë¤ó¤À¤±¤É¡¢¤Ç¤â¤â¤¦¤Á¤ç¤¤¤³¤¦¤Ê¤ó¤È¤«¤Í¤§¡£

(23:38)

ËÜÆü¤Î¥Ä¥Ã¥³¥ß(Á´3·ï) [¥Ä¥Ã¥³¥ß¤òÆþ¤ì¤ë]
_ ¤ç¤î (2008-06-29 00:04)

> Array#step
Enumerable#each_slice ¤Ç¤É¤¦¤Ç¤·¤ç¤¦¡©
ºÇ¸å¤Îü¿ô¤â yield ¤¹¤ë¤Î¤Ç¡¢¤Á¤ç¤Ã¤È»ÅÍͤ¬°ã¤¤¤Þ¤¹¤¬¡£

_ shinh (2008-06-29 00:23)

¤ª¤ª¤¹¤Ð¤é¤·¤¤¡£½ñ¤¤¤Æ¤«¤é¤¢¤ê¤½¤¦¤À¤Ê¡¼¤È¾¯¤·»×¤Ã¤¿¤Î¤Ç¤¹¤¬¡¢Ä´¤Ù¤ë¤Î¤ò¤µ¤Ü¤Ã¤Æ¤Þ¤·¤¿¡£¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£

_ ¤Ø¤ë¤ß (2008-06-29 00:30)

>¤³¤ì 0 ¤Ã¤Æ½ÐÎϤµ¤ì¤¿¤ó¤À¤¼¡Ä!
-Wall¤Ä¤±¤ë¤È¡Ö̤½é´ü²½¤À¤è¡×¤Ã¤Æʸ¶ç¸À¤ï¤ì¤Þ¤¹¤Í¡¥Ì¤ÄêµÁ¤Ê¤Î¤«¤Ê¡¥
gcc/VC¶¦¤ËºÇŬ²½¥ª¥×¥·¥ç¥ó¤Ë¤è¤Ã¤Æ½ÐÎÏ·ë²Ì¤¬ÊѤï¤ê¤Þ¤·¤¿¡¥

¤ªÌ¾Á°:
E-mail:
¥³¥á¥ó¥È:
¿ÍÀ¸¡¢±§Ãè¡¢¤¹¤Ù¤Æ¤ÎÅú¤¨
ËÜÆü¤Î¥ê¥ó¥¯¸µ

Á° 2008ǯ
6·î
¼¡
Æü ·î ²Ð ¿å ÌÚ ¶â ÅÚ
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
1.¤ä¤®(2008-07-22 19:39) 2.kosaki(2008-06-30 17:04) 3.¤Ø¤ë¤ß(2008-06-29 00:30)
search / home / index

Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ­¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£

shinichiro.hamaji _at_ gmail.com / shinichiro.h