ãã¾ã«ã¯ãä»ã®äººã®å½¹ã«ç«ã¤è¨äºãæ¸ããã¨ãããã¨ã§æ¸ãã¦ã¿ãã ä¾ãã°ã以ä¸ã®ãããªmix-inã使ã£ãã³ã¼ããããã¨ãããããªãã¢ã«ãªä¾ã§ç¹ã«å¿ è¦ã«ãªããããªã³ã¼ãã§ã¯ãªãããã©ãã¾ã説æã®ããã®ã³ã¼ããªã®ã§è¨±ãã¦ã»ããã EnumerableMixinã¯map()ãæä¾ãã¦ãã¦ããã®map()ãä»ã®ã¡ã½ãã(å®ç¾©ããã¦ããªãããã©)ã¯ãeach()ã«ä¾åããã¨ããmix-inãããã¦Listã¯each()ãå®è£ ããã¯ã©ã¹ãä½ã®å¤å²ããªãmix-inã®ã³ã¼ãã class EnumerableMixin: def map(self, fn): return [fn(x) for x in self.each()] class List(EnumerableMixin): def __init__(self, xs): self.xs = xs def each(self): return
{{#tags}}- {{label}}
{{/tags}}