| Iterator :: ¹è¿ :: Jagged. ¿©·¯ °³ÀÇ jagged ¹è¿À» ÅëÇØ ½Å¼ÓÇÏ°Ô permute ¹× ¹Ýº¹ÇÕ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
Iterator :: ¹è¿ :: Jagged. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~johnd/
Iterator :: ¹è¿ :: Jagged. ű×
Iterator :: ¹è¿ :: Jagged. ¼³¸í
¿©·¯ °³ÀÇ Jagged ¾î·¹À̸¦ ÅëÇØ ºü¸£°Ô ¼ÕÀ» ¶¼°í ¹Ýº¹ÇÕ´Ï´Ù iterator :: array :: Jagged´Â "jagged"¹è¿ÀÇ ÁýÇÕÀ» Åë°ú ÇÒ ¼öÀÖ´Â Perl ¸ðµâÀÔ´Ï´Ù. Varying lengthÀÇ ¹è¿ÀÔ´Ï´Ù. °¢ ¼¼Æ®ÀÇ "¼ýÀÚ"´Â ¿øÇÏ´Â ¸ðµç Á¾·ùÀÇ µ¥ÀÌÅ͸¦ °¡Áú ¼ö ÀÖÀ¸¸ç °¢ ÁýÇÕ¿¡´Â 1 °³ ÀÌ»óÀÇ ¿ä¼Ò°¡ Æ÷Ç﵃ ¼ö ÀÖ½À´Ï´Ù. ½Äº°ÀÚ »ç¿ë ITerator :: Array :: Jagged; # µ¥ÀÌÅÍ ÁýÇÕÀ» ºôµåÇÕ´Ï´Ù. my @data = (, , ); # °´Ã¼ ÁöÇâ ¸ðµåÀÇ ITerator : My $ Iterator = iterator :: ¹è¿ :: Jagged-> New (data => \ @data); while (my @set = $ iterator-> ´ÙÀ½) {print "´ÙÀ½ ¼³Á¤ : '". °¡ÀÔ ( "", @set). "'\N"; } # end while () # iterator´Â subrefÀÔ´Ï´Ù : my $ itersub = iterator :: array :: Jagged-> get_iterator (@Data); while (my @set = $ itersub -> ()) {print "´ÙÀ½ ¼³Á¤ : '". °¡ÀÔ ( "", @set). "'\N"; } # functional ÄÝ¹é ½ºÅ¸ÀÏ : iterator :: array :: jagged-> permute (sub {my (@set) = @_; "´ÙÀ½ ¼¼Æ® : '". ".", @set). " '\ n";}, @Data); ÄÚµå À§ÀÇ ÄÚµåÀÇ °¢ ¿¹Á¦´Â ´ÙÀ½À» ÀμâÇÕ´Ï´Ù. ´ÙÀ½ ÁýÇÕ : BCE'NEXT SET : ADE '´ÙÀ½ ¼¼Æ® : BDE'´ÙÀ½ ¼¼Æ® : ACF '´ÙÀ½ ¼¼Æ® : BCF'´ÙÀ½ ¼¼Æ® : ADF 'NEXT SET : BDF'NEXT SET : ACG 'NEXT SET : BCG'NEXT SET : ADG 'NEXT SET : BDG'¿ä±¸ »çÇ× : ¡¤ Perl.
Iterator :: ¹è¿ :: Jagged. °ü·Ã ¼ÒÇÁÆ®¿þ¾î