{"url":"https://mas-higa.hatenadiary.org/entry/20081004/1223111940","type":"rich","version":"1.0","categories":["Ruby"],"provider_name":"Hatena Blog","blog_title":"\u3072\u304c\u304d\u306e\u65e5\u8a18","title":"\u3082\u3046\u5c11\u3057\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u9811\u5f35\u3063\u3066\u307f\u308b","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmas-higa.hatenadiary.org%2Fentry%2F20081004%2F1223111940\" title=\"\u3082\u3046\u5c11\u3057\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u9811\u5f35\u3063\u3066\u307f\u308b - \u3072\u304c\u304d\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"author_url":"https://blog.hatena.ne.jp/mas-higa/","author_name":"mas-higa","height":"190","provider_url":"https://hatena.blog","description":"\u7b2c 30 \u56de Ruby/Rails \u52c9\u5f37\u4f1a\u306e\u6f14\u7fd2\u554f\u984c\u306e RPN \u96fb\u5353\u3002 \u4ed6\u306e\u4eba\u306e\u89e3\u7b54\u3092\u898b\u308b\u3068\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u9811\u5f35\u3063\u3066\u308b\u4eba\u304c\u3044\u305f\u306e\u3067\u3001\u81ea\u5206\u3082\u9811\u5f35\u3063\u3066\u307f\u308b\u3002\u4eca\u56de\u306e\u6f14\u7fd2\u3067\u306f\u3001\u307e\u305a\u30b9\u30bf\u30c3\u30af\u3092\u4f5c\u3063\u3066\u3001\u305d\u306e\u30b9\u30bf\u30c3\u30af\u3092\u4f7f\u3063\u3066 RPN \u3092\u4f5c\u308b\u3002 \u7a7a\u306e\u30b9\u30bf\u30c3\u30af\u304b\u3089 pop \u3057\u3088\u3046\u3068\u3059\u308b\u3068 Stack::EmptyStackError \u4f8b\u5916\u304c\u51fa\u308b\u4ed5\u69d8\u3002\u306a\u306e\u3067\u3001\u524d\u56de\u306e RPN \u96fb\u5353 \u305d\u306e\u5f0d \u306b\u4f8b\u5916\u30cf\u30f3\u30c9\u30e9\u3092\u66f8\u3044\u3066\u307f\u308b\u3002 require 'stack' def rpn(exp) num = Stack.new exp.each do |i| if /\\D/ =~ i num.push(num.pop.__send__(\u2026","published":"2008-10-04 18:19:00","blog_url":"https://mas-higa.hatenadiary.org/"}