日本Rubyの会 公式Wiki - 第32回 Ruby勉強会@関西 ã«è¡ã£ã¦ãã¾ããï¼ãªãã ããã ã§ã²ãã³ãã®Rubyåå¼·ä¼ã§ãã®ããã£ã! éå¶ã®ã¿ãªãã¾ãã¤ãããã¾ã§ããï¼
åå¼·ä¼ã«è¡ãã¨ï¼æ®æ®µå¾ãããªãåºæ¿ãããããå¾ããã¦è¯ãã§ããï¼æ¥å¸¸çæ´»ã¯ãã¿ã¼ã³ã«æ¼ãè¾¼ããã¡ã§ã ãã¦ããã®ã§ï¼å®æçã«éæ¥å¸¸ã«èªåããã£ã¦ãã®ã¯ï¼ç²¾ç¥è¡çä¸ããããã§ãï¼
å ¨è¬çãªè©³ç´°ã«ã¤ãã¦ã¯ï¼日本Rubyの会 公式Wiki - 第32回 Ruby勉強会@関西ã®ç¶ã ãããããã§ããããã©ãã¯ããã¯ã(ã¨ããã£ãããªããç¡å¹ã«ãªã£ã¦ã)ï¼ãã£ããã«è¡ã£ã¦ãã£ããã«ããããè¿·ã£ãï¼id:hitode909ããã®第32回 Ruby勉強会@関西に行った - hitode909の日記ã¨ããã¨ã³ããªãåç §ãã¦ã¿ã¦ãã ããï¼
ä»åã¯サイロスさんã®Fiberã«ã¤ãã¦ã®ã»ãã·ã§ã³ããããããã£ãã®ã§ï¼Fiberã«ã¤ãã¦ããããã³ã¼ããæ¸ãã¦ã¿ã¾ããï¼
Fiberã®ãåå¼·
Fiberã¨ããã¨Ruby1.9ããæè¼ããããã³ããªã¨ã³ããã£ããªã³ã«ã¼ãã³ã®ä»çµã¿ã§ãï¼ã¨ãã£ã¦ãï¼æ£ç´ä½¿ãã©ãããããããããªãæ©è½ã ãªã¼ã¨æã£ã¦ãã¾ããï¼ã ãããè¯ããããµã³ãã«ã¨ãã¦ï¼
ã¿ãããªã®ãããã¾ããï¼ä½ã«ä½¿ãã®ãã?ã¿ãããªæãã§ï¼Fiberã®ãããããããããããªãã§ãï¼
ãããªæï¼ä»åã®ã»ãã·ã§ã³ã§ç´¹ä»ããã¦æ°ã¥ããã®ã§ããï¼Fiberã¯Generatorãå®è£ ããã®ã«ï¼ã¡ããã©è¯ãæ©è½ãªãã§ããï¼ä¾ãã°ï¼è¯ãããGeneratorã¨ãã¦Counterã¨ãFibonacciæ°åã精製å¨ãFiberã使ã£ã¦æ¸ãã¨
generator_not_class.rb · GitHub
ã¿ããã«ãªãã¾ãï¼ãªããªãã¹ãããªæ¸ãã¾ããï¼å®éRuby1.9ã®Enumeratorã®ã¡ã½ããã§ã¯FiberãGeneratorã¨ãã¦ä½¿ãã¾ãã£ã¦ããããã§ãï¼ã¡ãªã¿ã«1.8.7ã®Enumerable::Enumeratorã§ã¯callccã使ã£ã¦ãããããªâ¦
Generatorã¨ãã¦ã®Fiberã®ä½¿ãã©ããã¯ãªããªãããããã§ãï¼Generatoræå¤ã®Lazyãªå¦çãæ¸ãã®ã«ä¾¿å©ããã§ï¼callccã®ããschemeãé 延è©ä¾¡ãªHaskellã§ã®ææ³ãã¾ãªãã§ããã°ãããã¨ããã¨ãã«ä½¿ãããã§ããï¼
ãã¾ã
ã¤ãã§ã«ï¼ä»ã®è¨èªã§Generatorãæ¸ãã¦ã¿ãï¼
Perl
Generatoræ§æã¯ãªãã®ã§ï¼ã¯ã©ã¹ã§ç¶æ ã管çãã¦å¿ è¦ã«å¿ãã¦ããããçæããã³ã¼ããã¡ã¾ã¡ã¾æ¸ãå¿ è¦ããã£ãï¼ããããã®ããã£ããæ¸ããã¢ã¸ã¥ã¼ã«ã¨ãããã®ããããï¼
JavaScript [è¿½è¨ 22:04]
generatoræ§æã¦å¦çç³»ã«ãã£ã¦ã¯ãã£ã¦ãããããª? ãã¨ã§èª¿ã¹ã
ã¨ããã£ã¦ããï¼ãã£ã±ãï¼JavaScript 1.7ããã¯generatorã使ããããã ã£ãï¼JavaScript 1.7 の新機能: Days on the Moonã«ã¾ãã¾ããã解説ããããï¼id:nanto_vi++
Firefoxã®ããã ãã«ã³ã¼ãæ¸ãã®ãªãããããæ©è½ãã©ãã©ã使ã£ã¦ããããããªã¼ï¼GreaceMonkeyã¨ãFirefoxæ¡å¼µã¨ãããããã·ã¼ã³ã¯ããããããæ°ãããï¼