<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ma2saka</author_name>
  <author_url>https://blog.hatena.ne.jp/ma2saka/</author_url>
  <blog_title>0xf</blog_title>
  <blog_url>https://0xf.hatenablog.com/</blog_url>
  <categories>
    <anon>プログラミング</anon>
    <anon>日記</anon>
  </categories>
  <description>yield でシュッといけるわけではないのだが channel を返せばいいか? func each(s, e int) &lt;-chan int { r := make(chan int) go func() { defer close(r) for i := s; i &lt; e; i++ { r &lt;- i } }() return r } func main() { for i := range each(10, 20) { fmt.Println(i) } } range に channel を渡すと close までイテレートしてくれる、というデザインはこう使うことを想定はしているんだろう。…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2F0xf.hatenablog.com%2Fentry%2F2022%2F11%2F05%2F184045&quot; title=&quot;pythonのジェネレータ的な書き味をgolangで - 0xf&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-11-05 18:40:45</published>
  <title>pythonのジェネレータ的な書き味をgolangで</title>
  <type>rich</type>
  <url>https://0xf.hatenablog.com/entry/2022/11/05/184045</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
