List::FrontCode
å æ¥ Array::Gap ã¨ãã Variable Byte Codes ã«ããæ´åæ¸ã¿æ´æ°ã®å§ç¸®ã®å®è£ ãä½ãã¾ããã(id:naoya:20080906:1220685978)
ä»æ¥ã¯ Front Coding ã使ã£ãåããããªå§ç¸®ãªã¹ãã¯ã©ã¹ãList::FrontCode ãä½ã£ã¦ã¿ã¾ãããFront Coding ã¯è¾æ¸å¼é ã«æ´åæ¸ã¿ã®æååãªã¹ããªã©ãå§ç¸®ããææ³ã§ããWEB+DB PRESS Vol.42 ã®ã¢ã«ã´ãªãºã &ãã¼ã¿æ§é ã®è¨äºã§ PFI ã®å²¡éåããã«ãã解説ããã£ãã®ã§ããããåèã«å®è£ ãã¾ããã
Front Coding
Front Coding ã¯
http://www.hoge.jp http://www.hoge.jp/a.htm http://www.hoge.jp/index.htm http://www.fuga.com/ http://www.fugafuga.com/
ã¨ããè¾æ¸å¼é åºã§æ´åæ¸ã¿ã®æååãªã¹ãã
http://www.hoge.jp 18/a.htm 19index.htm 11fuga.com 15fuga.com
ã¨åã®è¦ç´ ã¨ã®ä¸è´é¨åãæåæ°ã«ç½®ãæãããã¨ã«ããå§ç¸®å¹æãå¾ãææ³ã§ããURL ã®ããã«ä¼¼éã£ãå§ã¾ãæ¹ããããã¼ã¿ã大éã«ããã¨ãã«ä½¿ããå§ç¸®ææ³ã§ãã
List::FrontCode
- List::FrontCode
- http://github.com/naoya/perl-list-frontcode/tree/master
List::FrontCode ã¯ãæ´åæ¸ã¿æååè¦ç´ ã Front Code ã§å§ç¸®ãã¦ä¿æããã¯ã©ã¹ã§ããå§ç¸®ããããã¼ã¿ã¯ãArray::Gap åæ§ãã¤ãã¬ã¼ã¿ã§ã¢ã¯ã»ã¹ãããã¨ã«ããå é ããä¸è¦ç´ ãã¤è§£åããªããåå¾ãããã¨ãã§ãã¾ãã
#!/usr/local/bin/perl use strict; use warnings; use FindBin::libs; use Perl6::Say; use List::FrontCode; my @keys = ( 'http://www.hoge.jp', 'http://www.hoge.jp/a.htm', 'http://www.hoge.jp/index.htm', 'http://www.fuga.com/', 'http://www.fugafuga.com/', ); my $list = List::FrontCode->new; for (@keys) { $list->push($_); } my $it = $list->iterator; while ($it->has_next) { say $it->next; }
ã¨ããã³ã¼ããå®è¡ããã¨ã
http://www.hoge.jp http://www.hoge.jp/a.htm http://www.hoge.jp/index.htm http://www.fuga.com/ http://www.fugafuga.com/
ã¨ããçµæã«ãªãã¾ãã
say $list;
ã¨ãããã¨ã§å§ç¸®ããã¦ããç¶æ ãç»é¢ã«åºåãããã¨ãã§ãã¾ãããã®ä¾ã§ã®åºåã¯
http://www.hoge.jp/a.htm index.htm fuga.com/ fuga.com/
ã¨ãªãã¾ããã岡éåããã®ãµã³ãã«ã³ã¼ãã§ã¯ãä¸è´é¨åã®æ´æ°ãæ´ã«å¯å¤ãã¤ãç¬¦å· (Variable Byte Codes) ã§è¡¨ç¾ãã¦ããã®ã§ãããã«ç¿ã£ã¦èªåã®å®è£ ãæ´æ°é¨åãå¯å¤ãã¤ã符å·ã§è¡¨ç¾ãã¦ãã¾ãããã®ããæ´æ°é¨åã®åºåã空ç½ã«ãªã£ã¦ãã¾ãã
å§ç¸®çã§ããã
say sprintf "%d bytes => %d bytes", length(join '', @keys), length $list;
114 bytes => 61 bytes
ã¨ãªãã¾ãããååå¼±ã«å§ç¸®ã§ãã¦ãã¾ãã
Front Coding 㯠IIR ã®5ç« ã§ã軽ãç´¹ä»ããã¦ãã¾ããããããã¾ã§ç解ãææ§ã§ãããä»å WEB+DB PRESS ãåç §ããªããå®è£ ãã¦ã¿ã¦æ£ããç解ãããã¨ãã§ãã¾ããã岡éåãããæè¡è©è«ç¤¾ããã«æè¬ã
- ä½è : ç¸é¦¬ç´å¹³,岡éå大è¼,æ± éæºæ´,æ°¸å®æå²,é´æ¨æ ä¹ä»,åç°åå¼,é«æ©å¾ç¾©,尾島è¯å¸,çªè¡å¥å¤ªé,é«æå²,å çãµãã¼ã«,ç°ä¸ã°ã³ã,æ¡å±±ä¿ä¹,å°é£¼å¼¾,å®®å·é彦,ãã¤ã,é½è¤å®å¤,è§ç°ç´è¡,ããã¿ãã ãã,ç¾½çç« æ´,åç°å人,æ«æ°¸å¡,天éä»å²,å·æ丹ç¾,è§è°·ä¿¡å¤ªé,ã²ããã¾ããã,å¤æé å²,æè°·ä¿å¹¸,æ¨éç¬å人,æ±å£æ»,西澤æ,ä¼è¤ç´ä¹,ç¹ç°åäº,竹ä¸è¯å·±,å±±æ¬é½å¹³,é«äºç´äºº,WEB+DB PRESSç·¨éé¨
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2007/12/22
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 7人 ã¯ãªãã¯: 171å
- ãã®ååãå«ãããã° (57件) ãè¦ã