{"id":218,"date":"2010-04-01T00:30:57","date_gmt":"2010-03-31T15:30:57","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2010\/04\/01\/_10\/"},"modified":"2010-04-01T00:30:57","modified_gmt":"2010-03-31T15:30:57","slug":"_10","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2010\/04\/01\/_10\/","title":{"rendered":"\u4e00\u4eba\u8aad\u66f8\u4f1a \u300c\u8a08\u7b97\u6a5f\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u69cb\u9020\u3068\u89e3\u91c8\u300d (10)"},"content":{"rendered":"<p><a href=\"http:\/\/www.amazon.co.jp\/dp\/489471163X?tag=typea09-22&amp;link_code=as3&amp;creativeASIN=489471163X&amp;creative=3999&amp;camp=767\"><img decoding=\"async\" src=\"http:\/\/images-jp.amazon.com\/images\/P\/489471163X.09.MZZZZZZZ.jpg\" complete=\"complete\"><\/a> <\/p>\n<p>&nbsp;<\/p>\n<h2>1.1.8 \u30d6\u30e9\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u62bd\u8c61\u3068\u3057\u3066\u306e\u624b\u7d9a\u304d <\/h2>\n<p>&nbsp;<\/p>\n<p>\u65b0\u3057\u3044\u8a00\u8a9e\u3092\u899a\u3048\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u307e\u305a\u5909\u6570\u306e\u5ba3\u8a00\u306e\u4ed5\u65b9\u3084\u3001\u5236\u5fa1\u69cb\u6587\u3092\u899a\u3048\u308b\u304c\u30011\u3064\u306a\u306b\u304b\u77e5\u3063\u3066\u3044\u308c\u3070\u305d\u308c\u3089\u3092\u899a\u3048\u308b\u304f\u3089\u3044\u306f\u4f55\u306e\u3053\u3068\u306f\u306a\u3044\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u30d1\u30e9\u30c0\u30a4\u30e0\u304c\u7570\u306a\u308b\u3068\u3053\u308c\u306f\u5927\u5909\u3002\u591a\u5206\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9e\u3067\u7fd2\u5f97\u304c\u96e3\u89e3\u3068\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u3089\u306f\u3001\u30d1\u30e9\u30c0\u30a4\u30e0\u306e\u76f8\u9055\u306b\u8d77\u56e0\u3057\u3066\u3044\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u3001\u3053\u306e\u7ae0\u3092\u8aad\u3093\u3067\u601d\u3063\u305f\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001C\u8a00\u8a9e\u306e\u30dd\u30a4\u30f3\u30bf\u30fc\u306a\u3093\u3066\u3001\u9ad8\u7d1a\u8a00\u8a9e\u3067\u3042\u308bC\u8a00\u8a9e\u306b\u3001\u30a2\u30bb\u30f3\u30d6\u30e9\u306e\u30d1\u30e9\u30c0\u30a4\u30e0\u304c\u6301\u3061\u8fbc\u307e\u308c\u3066\u3044\u308b\u306e\u304c\u96e3\u89e3\u3068\u3044\u308f\u308c\u308b\u539f\u56e0\u3060\u308d\u3046\u3057\u3001\u69cb\u9020\u5316\u8a00\u8a9e\u306b\u6d78\u304b\u3063\u3066\u3044\u308c\u3070\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u306f\u3061\u3093\u3077\u3093\u304b\u3093\u3077\u3093\u3060\u308d\u3046\u3002\u305f\u3060\u3057\u3001\u9006\u304b\u3089\u307f\u308c\u3070\u3001\u3042\u307e\u308a\u306b\u3082\u81ea\u660e\u904e\u304e\u3066\u3001\u4f55\u304c\u96e3\u89e3\u304b\u5206\u304b\u3089\u306a\u3044\u3060\u308d\u3046\u3002<\/p>\n<p>\u306a\u305c\u3001\u305d\u3093\u306a\u3053\u3068\u3092\u601d\u3063\u305f\u304b\u3068\u3044\u3046\u3068\u3001\u3061\u3087\u3063\u3068\u524d\u306b\u3001<a href=\"http:\/\/ja.wikipedia.org\/wiki\/%E3%82%AF%E3%83%AD%E3%83%BC%E3%82%B8%E3%83%A3%E3%83%BC\" target=\"_blank\">\u30af\u30ed\u30fc\u30b8\u30e3\u30fc<\/a>\u95a2\u6570\u304c\u306f\u3084\u3063\u305f(?)\u304c\u3001\u5f53\u521d\u4f55\u306e\u3053\u3068\u3084\u3089\u5206\u304b\u3089\u306a\u304b\u3063\u305f\u3002\u307e\u305f\u3001\u30ec\u30ad\u30b7\u30ab\u30eb\u5909\u6570\u3068\u304b\u8a00\u3046\u7528\u8a9e\u306e\u610f\u5473\u3082\u3088\u304f\u5206\u304b\u3089\u306a\u304b\u3063\u305f\u3002\u305d\u3053\u305d\u3053\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u3044\u305f\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3002<\/p>\n<p>\u305d\u308c\u3089\u306e\u6982\u5ff5\u304c\u3001\u81ea\u5206\u304c\u4e3b\u306b\u3084\u3063\u3066\u304d\u305f\u8a00\u8a9e\u306b\u306f\u7121\u304b\u3063\u305f\u304b\u3089\u3001\u7406\u89e3\u3059\u308b\u306e\u306b\u624b\u9593\u53d6\u3063\u305f\u304c\u3001\u3053\u306e\u7ae0\u3067\u8ff0\u3079\u3089\u308c\u3066\u3044\u308b\u7528\u8a9e\u3092\u304d\u3061\u3093\u3068\u7406\u89e3\u3057\u3066\u3044\u308c\u3070\u3001\u305d\u306e\u3069\u3061\u3089\u3082\u60a9\u3080\u3053\u3068\u306a\u304f\u7406\u89e3\u3067\u304d\u305f\u3060\u308d\u3046\u306a\u3041\u3068\u3002<\/p>\n<p>\u81ea\u5206\u306e\u8208\u5473\u306e\u5909\u9077\u306f Java \u2192 JavaScript \u2192 Python \u2192 Scheme&nbsp; \u306a\u611f\u3058\u3060\u304c\u3001\u4eca\u601d\u3046\u3068\u4f55\u3068\u3044\u3046\u304b\u81ea\u7136\u306b\u601d\u3048\u308b\u3002<\/p>\n<h3>\u624b\u7d9a\u304d\u62bd\u8c61(procedural abstraction)<\/h3>\n<p>&nbsp;<a href=\"http:\/\/ja.wikipedia.org\/wiki\/%E5%88%86%E5%89%B2%E7%B5%B1%E6%B2%BB%E6%B3%95\" target=\"_blank\">\u5206\u5272\u7d71\u6cbb\u6cd5<\/a>\u3092\u7528\u3044\u308b\u3068\u304d\u3001\u90e8\u5206\u306e\u624b\u7d9a\u304d\u304c\u3069\u3046\u7d50\u679c\u3092\u8a08\u7b97\u3059\u308b\u306e\u304b\u306b\u306f\u95a2\u5fc3\u3092\u6301\u305f\u306a\u3044\u3002Wikipedia\u3067\u306f\u3001\u300c<a href=\"http:\/\/ja.wikipedia.org\/wiki\/%E5%88%86%E5%89%B2%E7%B5%B1%E6%B2%BB%E6%B3%95\" target=\"_blank\">\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u81ea\u7531\u306b\u9078\u629e\u3067\u304d\u308b<\/a>\u300d\u3068\u3055\u308c\u3066\u3044\u308b\u3002\u305d\u308c\u306f\u300c\u624b\u7d9a\u304d\u300d\u3067\u306f\u306a\u304f\u3001\u300c<strong>\u624b\u7d9a\u304d\u62bd\u8c61(procedural abstraction)<\/strong>\u300d\u3067\u3042\u308b\u3002<\/p>\n<h3>\u5c40\u6240\u540d<\/h3>\n<p>\u624b\u7d9a\u304d\u306e\u4eee\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u3069\u3093\u306a\u540d\u524d\u3067\u3082\u304b\u307e\u308f\u306a\u3044\u3002\u624b\u7d9a\u304d\u672c\u4f53\u306b\u5bfe\u3057\u3066\u5c40\u6240\u7684\u3067\u7121\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n<h3>\u675f\u7e1b\u5909\u6570(bound variable)<\/h3>\n<p>\u624b\u7d9a\u304d\u5b9a\u7fa9\u306e\u306a\u304b\u3067\u3001\u4eee\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3069\u3093\u306a\u540d\u524d\u3067\u3082\u304b\u307e\u308f\u306a\u3044\u3057\u3001\u540d\u524d\u3092\u3059\u3079\u3066\u5909\u66f4\u3057\u3066\u3082\u624b\u7d9a\u304d\u306e\u610f\u5473\u306f\u5909\u308f\u3089\u306a\u3044\u3068\u3044\u3046\u610f\u5473\u3067\u3001\u624b\u7d9a\u304d\u5b9a\u7fa9\u306f\u3001\u4eee\u30d1\u30e9\u30e1\u30fc\u30bf\u3092<strong>\u675f\u7e1b\u3057\u3066\u3044\u308b(bind)<\/strong>\u3002\u305d\u3046\u3044\u3046\u540d\u524d\u3092<strong>\u675f\u7e1b\u5909\u6570(bound variable)<\/strong>\u3068\u3044\u3046\u3002\u5909\u6570\u304c\u675f\u7e1b\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u3001<strong>\u81ea\u7531\u3067\u3042\u308b(free)\u3002<\/strong><\/p>\n<h3>\u6709\u52b9\u7bc4\u56f2(Scope)<\/h3>\n<p>\u540d\u524d\u304c\u675f\u7e1b\u3055\u308c\u3066\u3044\u308b\u5f0f\u306e\u7bc4\u56f2<\/p>\n<h3>\u30d6\u30ed\u30c3\u30af\u69cb\u9020(block structure)<\/h3>\n<p>\u5b9a\u7fa9\u306e\u5165\u308c\u5b50\u3002\u5358\u7d14\u306a\u540d\u524d\u4fdd\u8b77\u306e\u6a5f\u69cb\u3002\u3053\u3053\u3067\u4f5c\u6210\u3057\u305f\u3001<a href=\"\/blg\/glob\/2010\/03\/_6.html\" target=\"_blank\">sqrt2<\/a> \u95a2\u6570\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u308b\u95a2\u6570\u3001average\u3001square\u3001good-enough? \u30fb\u30fb\u30fb \u3092 sqrt2 \u95a2\u6570\u306e\u30d6\u30ed\u30c3\u30af\u306e\u4e2d\u306b\u5b9a\u7fa9\u3067\u304d\u308b\u3002sqrt2 \u30d6\u30ed\u30c3\u30af\u306e\u5916\u3067\u3001\u540c\u540d\u306e\u624b\u7d9a\u304d\u3092\u5b9a\u7fa9\u3057\u3066\u3082\u3001\u305d\u308c\u305e\u308c\u306b\u306f\u5f71\u97ff\u3092\u4e0e\u3048\u306a\u3044\u3002<\/p>\n<pre class=\"prettyprint linenums\">(define (sqrt2 x) \r\n  (define (average x y) (\/ (+ x y) 2))\r\n  (define (square x) (* x x))\r\n  (define (good-enough? guess x)\r\n    (&lt; (abs (- (square guess) x)) 0.001))\r\n  (define (improve guess x)\r\n    (average guess (\/ x guess)))\r\n  (define (sqrt-itr guess x) \r\n    (if (good-enough? guess x)\r\n        guess\r\n        (sqrt-itr (improve guess x)\r\n                  x)))\r\n  (sqrt-itr 1.0 x))\r\n<\/pre>\n<h3>\u9759\u7684\u6709\u52b9\u7bc4\u56f2(lexicacl scoping)<\/h3>\n<p>\u4e0a\u8a18\u4f8b\u3067\u3001x \u306f\u3001sqrt2 \u306e\u5b9a\u7fa9\u306b\u675f\u7e1b\u3055\u308c\u3066\u3044\u308b\u3002\u306a\u306e\u3067\u3001\u305d\u306e\u5185\u5074\u306e\u95a2\u6570\u306f\u3001x \u306e\u6709\u52b9\u7bc4\u56f2\u5185\u306b\u3042\u308b\u305f\u3081\u660e\u793a\u7684\u306b\u6e21\u3055\u306a\u304f\u3066\u3082\u3088\u3044\u306e\u3067\u3001\u81ea\u7531\u5909\u6570\u306b\u3067\u304d\u308b\u3002\u3053\u3046\u3057\u305f\u3084\u308a\u65b9\u3092<strong>\u9759\u7684\u6709\u52b9\u7bc4\u56f2(lexical scoping)<\/strong> \u3068\u3044\u3046\u3002<\/p>\n<pre class=\"prettyprint linenums\">(define (sqrt2 x) \r\n  (define (average a b) (\/ (+ a b) 2))\r\n  (define (good-enough? guess)\r\n    (&lt; (abs (- (* guess guess) x)) 0.001))\r\n  (define (improve guess)\r\n    (average guess (\/ x guess)))\r\n  (define (sqrt-itr guess) \r\n    (if (good-enough? guess)\r\n        guess\r\n        (sqrt-itr (improve guess))))\r\n  (sqrt-itr 1.0))\r\n<\/pre>\n<p>\u4eca\u65e5\u306f\u3053\u3053\u307e\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; 1.1.8 \u30d6\u30e9\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u62bd\u8c61\u3068\u3057\u3066\u306e\u624b\u7d9a\u304d &nbsp; \u65b0\u3057\u3044\u8a00\u8a9e\u3092\u899a\u3048\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u307e\u305a\u5909\u6570\u306e\u5ba3\u8a00\u306e\u4ed5\u65b9\u3084\u3001\u5236\u5fa1\u69cb\u6587\u3092\u899a\u3048\u308b\u304c\u30011\u3064\u306a\u306b\u304b\u77e5\u3063\u3066\u3044\u308c\u3070\u305d\u308c\u3089\u3092\u899a\u3048\u308b\u304f\u3089\u3044\u306f\u4f55\u306e\u3053\u3068\u306f\u306a\u3044\u3002 \u3057\u304b\u3057\u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[33,20,34,35,36],"tags":[],"class_list":["post-218","post","type-post","status-publish","format-standard","hentry","category-lisp","category-python","category-scheme","category-math","category-reading"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=218"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/218\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}