問題5.11 a. – SICP(計算機プログラムの構造と解釈)その258

問題5.11 a. afterfib-n-2 の内容を次のように変更できる。 afterfib-n-2 (assign n (reg val)) (restore val) … ↓ afterfib-n-2 (restore n) … 問題5.6のように (fib 4) として、スタックの処理内容を書き出してみる。 ; [n] [val] [continue] [stack] (test (op <) (reg n) (const 2)) ; [n:4] [val:] [continue:fib-done] [stack:()] (< 4 2) => false (save continue) ; [n:4] [val:] [continue:fib-done] [stack:(fib-done)] (assign continue (label afterfib-n-1)) ; [...]…

続きを読む

問題5.9 – SICP(計算機プログラムの構造と解釈)その257

問題5.9 (define (make-operation-exp exp machine labels operations) (let ((op (lookup-prim (operation-exp-op exp) operations)) (aprocs (map (lambda (e) (if (label-exp? e) (error "Operations can be used only with registers and constants — ASSEMBLE" e) (make-primitive-exp e machine labels))) (operation-exp-operands exp)))) (lambda () (apply op (map (lambda (p) (p)) aprocs))))) 問題5.10 パス 計算機プログラムの構造と解釈 posted with amazlet at [...]…

続きを読む

問題5.8 – SICP(計算機プログラムの構造と解釈)その256

問題5.8 1つめの here から there に達したとき、2つめの here には制御は移らないため、レジスタ a の内容は 3 となる。 (define test-machine (make-machine ‘(a) ‘() ‘(start (goto (label here)) here (assign a (const 3)) (goto (label there)) here (assign a (const 4)) (goto (label there)) there))) 実行結果 (set-register-contents! test-machine ‘a 0) gosh> done (start test-machine) gosh> done (get-register-contents test-machine ‘a) gosh> 3 重複するラベル名を見つけた場合にエラーとするよう修正した [...]…

続きを読む

float:left; で作ったカラム内で float を使う

CSS のプロパティ float を使って2カラムレイアウトのページを作り、そのカラム内でさらに float を使って回り込みを行い clear で float の解除を行うと2カラムレイアウトの float も解除されてしまう。 そこで、display:table; を使い clear を使わずにカラム内の float の効く範囲を限定させ…

続きを読む

neocomplcache.vim で数字キーによるクイックマッチを停止する

キーワード補完 Vim プラグインの neocomplcache で CSS の編集の際に margin や padding などの数値を入力しようとすると数字キーのクイックマッチが働いてしまい使いづらかったので、CSS の編集時のみ数字キーによるクイックマッチを止めさせる設定を行った。 CSS の編集…

続きを読む

Scheme で音楽

Impromptu: Scheme ベースのライブコーディング環境 – Radium Software Scheme でリアルタイムにコードを書きながら音楽を作っている。 ryukyu がいい。 おもしろいな。…

続きを読む

問題5.7 – SICP(計算機プログラムの構造と解釈)その255

問題5.7 再帰的べき乗を計算する計算機 (define expt-machine (make-machine ‘(b n val continue) (list (list ‘= =) (list ‘* *) (list ‘- -)) ‘((assign continue (label expt-done)) expt-loop (test (op =) (reg n) (const 0)) (branch (label base-case)) (save continue) (save n) (assign n (op -) (reg n) (const 1)) (assign continue (label after-expt)) (goto (label expt-loop)) after-expt (restore [...]…

続きを読む

WordPress データベースの自動バックアップ (WP-DB-Backup)

WordPress のデータベースを自動でバックアップしてくれるプラグイン WP-DB-Backup をインストール・設定する。 ダウンロードしてアーカイブを展開したフォルダを wp-content/plugins/ ディレクトリに配置して、『プラグインの管理』ページから『使用する』をクリック…

続きを読む

WordPress での自動アップグレード (xrea サーバ)

xrea サーバで WordPress のプラグインの自動アップグレードを行う方法について。 初期状態では『ディレクトリが見つかりません』と表示されてエラーになってしまうので、wp-config.php に以下の記述を追加しておく。 define(‘FTP_BASE’, ‘/vertual/account/public_html/wordpress/’); define(‘FTP_CONTENT_DIR’, ‘/vertual/account/public_html/wordpress/wp-content/’); define(‘FTP_PLUGIN_DIR’, ‘/vertual/account/public_html/wordpress/wp-content/plugins/’); また、xrea サーバは PHP がセーフモードで動…

続きを読む

MacVim KaoriYa 20090911版 と ATOK2008

MacVim KaoriYa 20090911版がテストリリースされ、日本語変換中にカーソル位置が文字列の先頭に行ってしまう問題が修正されていた。 ところが、日本語変換についてもっと大きな問題を発見した。 ATOK2008で日本語変換する際に、文節に分かれた変換文字列…

続きを読む
Page 2 of 41234
↑ページの先頭へ