{"id":7262,"date":"2012-03-09T08:55:14","date_gmt":"2012-03-09T13:55:14","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=7262"},"modified":"2012-03-09T08:55:14","modified_gmt":"2012-03-09T13:55:14","slug":"still-rather-more-proud-of-this-code-than-i-should-be","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2012\/03\/09\/still-rather-more-proud-of-this-code-than-i-should-be\/","title":{"rendered":"still rather more proud of this code than I should be"},"content":{"rendered":"<p>Years ago, I wrote this tiny subroutine in PostScript:<\/p>\n<pre>\/box { % draw a box given lower left and upper right corner coordinates\r\n\u00c2\u00a0 2 copy moveto\r\n\u00c2\u00a0 3 index exch lineto\r\n\u00c2\u00a0 3 -1 roll 2 index lineto\r\n\u00c2\u00a0 exch lineto\r\n\u00c2\u00a0 closepath\r\n} def<\/pre>\n<p>All it does is define a rectangular path given by four numbers. So to draw a box from (0,0) to (100,50), you&#8217;d say<\/p>\n<pre>0 0 100 50 box\r\nstroke<\/pre>\n<p>This code still pleases me because:<\/p>\n<ul>\n<li>it accepts arguments in a sensible order<\/li>\n<li>it uses no local variables, relying purely on the stack<\/li>\n<li>no spare values have to be popped from the stack at any time.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Years ago, I wrote this tiny subroutine in PostScript: \/box { % draw a box given lower left and upper right corner coordinates \u00c2\u00a0 2 copy moveto \u00c2\u00a0 3 index exch lineto \u00c2\u00a0 3 -1 roll 2 index lineto \u00c2\u00a0 exch lineto \u00c2\u00a0 closepath } def All it does is define a rectangular path given [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[2471,812,2472],"class_list":["post-7262","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-box","tag-postscript","tag-stack"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-1T8","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/7262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=7262"}],"version-history":[{"count":3,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/7262\/revisions"}],"predecessor-version":[{"id":7265,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/7262\/revisions\/7265"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=7262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=7262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=7262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}