{"id":99,"date":"2002-12-05T17:40:25","date_gmt":"2002-12-05T22:40:25","guid":{"rendered":"\/?p=99"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"functional_python","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2002\/12\/05\/functional_python\/","title":{"rendered":"Functional Python"},"content":{"rendered":"<p><a href=\"http:\/\/dsandler.org\/entry.php?1282\">Daniel Sandler<\/a> shows how to write <code>objectcurry<\/code> in Python:<\/p>\n\n\n\n<blockquote>Called with an object and the name of a method, will return a standalone function that can be called at any time (as if it were still connected to its object).<\/blockquote>\n\n\n\n<p>It seems that Python doesn&rsquo;t have real closures, but I was able to write <code>make-adder<\/code> using the single-element array technique that&rsquo;s often used with Java inner classes. I also found Peter Norvig&rsquo;s <a href=\"http:\/\/www.norvig.com\/python-lisp.html\">Python for Lisp Programmers<\/a> page, which has some great examples of when Python&rsquo;s more mainstream syntax is and isn&rsquo;t a win. Norvig says that &ldquo;Python can be seen as either a practical (better libraries) version of Scheme, or as a cleaned-up (no $@&amp;%) version of Perl.&rdquo; Finally, the <a href=\"http:\/\/sourceforge.net\/projects\/xoltar-toolkit\">Xoltar toolkit<\/a> adds functional programming support to Python.<\/p>","protected":false},"excerpt":{"rendered":"<p>Daniel Sandler shows how to write objectcurry in Python: Called with an object and the name of a method, will return a standalone function that can be called at any time (as if it were still connected to its object). It seems that Python doesn&rsquo;t have real closures, but I was able to write make-adder [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-99","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/99","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}