[数式処理][Scheme] 算術式を簡単にする

微分などで複雑になった算術式を簡素化するには次のようにする。 (define (simple exp) (define (flat lst op) (append-map! (lambda (x) (if (and (pair? x) (eq? (car x) op)) (flat (cdr x) op) (list x))) lst)) (define (constant-fold args init op) (define (cf args num acc) (cond ((null? args) (values Continue reading [数式処理][Scheme] 算術式を簡単にする


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply

[数式処理][Scheme] 微分する

複雑な微分をするときは計算機に任せた方が良いように思う。 Scheme で微分するには次のようにする。 (define (deriv exp var) (cond ((eq? exp var) 1) ((not (pair? exp)) 0) ((eq? (car exp) ‘-) `(- ,(deriv (cadr exp) var))) ((eq? (car exp) ‘+) `(+ ,(deriv (cadr exp) var) ,(deriv (caddr exp) var))) ((eq? (car Continue reading [数式処理][Scheme] 微分する


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply

[Scheme][Racket] 相対パスでロード

Racketで相対パスを用いてロードする際の注意。 load で相対パスを使った場合は current-directory (デフォルトでは実行パス)を基点にロードパスが決まる。 ただ、”./filename” や “../filename” といった形式は使えなかった。 current-directory と結合してOSに丸投げするだけでいいのに、信じられない。 ロードされているファイルからそのファイルのあるディレクトリを基点に相対パスでロードする場合は load-relative を用いる。 (load-relative “relative-path”) その際、基点となるディレクトリは current-load-relative-directory 関数で取得できる。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , | Leave a reply

[JavaScript] Base64のデコード

JavaScriptでBase64をデコードするには次のように書く。 var b64_table = [ ‘\x00′,’\x01′,’\x02′,’\x03′,’\x04′,’\x05′,’\x06′,’\x07’, ‘\x08′,’\x09′,’\x0A’,’\x0B’,’\x0C’,’\x0D’,’\x0E’,’\x0F’, ‘\x10′,’\x11′,’\x12′,’\x13′,’\x14′,’\x15′,’\x16′,’\x17’, ‘\x18′,’\x19′,’\x1A’,’\x1B’,’\x1C’,’\x1D’,’\x1E’,’\x1F’, ‘\x20′,’\x21′,’\x22′,’\x23′,’\x24′,’\x25′,’\x26′,’\x27’, ‘\x28′,’\x29′,’\x2A’,’\x2B’,’\x2C’,’\x2D’,’\x2E’,’\x2F’, ‘\x30′,’\x31′,’\x32′,’\x33′,’\x34′,’\x35′,’\x36′,’\x37’, ‘\x38′,’\x39′,’\x3A’,’\x3B’,’\x3C’,’\x3D’,’\x3E’,’\x3F’, ‘\x40′,’\x41′,’\x42′,’\x43′,’\x44′,’\x45′,’\x46′,’\x47’, ‘\x48′,’\x49′,’\x4A’,’\x4B’,’\x4C’,’\x4D’,’\x4E’,’\x4F’, ‘\x50′,’\x51′,’\x52′,’\x53′,’\x54′,’\x55′,’\x56′,’\x57’, ‘\x58′,’\x59′,’\x5A’,’\x5B’,’\x5C’,’\x5D’,’\x5E’,’\x5F’, ‘\x60′,’\x61′,’\x62′,’\x63′,’\x64′,’\x65′,’\x66′,’\x67’, ‘\x68′,’\x69′,’\x6A’,’\x6B’,’\x6C’,’\x6D’,’\x6E’,’\x6F’, ‘\x70′,’\x71′,’\x72′,’\x73′,’\x74′,’\x75′,’\x76′,’\x77’, ‘\x78′,’\x79′,’\x7A’,’\x7B’,’\x7C’,’\x7D’,’\x7E’,’\x7F’, ‘\x80′,’\x81′,’\x82′,’\x83′,’\x84′,’\x85′,’\x86′,’\x87’, ‘\x88′,’\x89′,’\x8A’,’\x8B’,’\x8C’,’\x8D’,’\x8E’,’\x8F’, ‘\x90′,’\x91′,’\x92′,’\x93′,’\x94′,’\x95′,’\x96′,’\x97’, ‘\x98′,’\x99′,’\x9A’,’\x9B’,’\x9C’,’\x9D’,’\x9E’,’\x9F’, ‘\xA0′,’\xA1′,’\xA2′,’\xA3′,’\xA4′,’\xA5′,’\xA6′,’\xA7’, ‘\xA8′,’\xA9′,’\xAA’,’\xAB’,’\xAC’,’\xAD’,’\xAE’,’\xAF’, ‘\xB0′,’\xB1′,’\xB2′,’\xB3′,’\xB4′,’\xB5′,’\xB6′,’\xB7’, ‘\xB8′,’\xB9′,’\xBA’,’\xBB’,’\xBC’,’\xBD’,’\xBE’,’\xBF’, ‘\xC0′,’\xC1′,’\xC2′,’\xC3′,’\xC4′,’\xC5′,’\xC6′,’\xC7’, ‘\xC8′,’\xC9′,’\xCA’,’\xCB’,’\xCC’,’\xCD’,’\xCE’,’\xCF’, ‘\xD0′,’\xD1′,’\xD2′,’\xD3′,’\xD4′,’\xD5′,’\xD6′,’\xD7’, ‘\xD8′,’\xD9′,’\xDA’,’\xDB’,’\xDC’,’\xDD’,’\xDE’,’\xDF’, ‘\xE0′,’\xE1′,’\xE2′,’\xE3′,’\xE4′,’\xE5′,’\xE6′,’\xE7’, ‘\xE8′,’\xE9′,’\xEA’,’\xEB’,’\xEC’,’\xED’,’\xEE’,’\xEF’, ‘\xF0′,’\xF1′,’\xF2′,’\xF3′,’\xF4′,’\xF5′,’\xF6′,’\xF7’, ‘\xF8′,’\xF9′,’\xFA’,’\xFB’,’\xFC’,’\xFD’,’\xFE’,’\xFF’ ]; function b64_decode_char(c){ Continue reading [JavaScript] Base64のデコード


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , | Leave a reply

[Git] 指定したブランチにpushする

無引数でpushして、push先にブランチが出来ず、嵌まったのでメモ。 pushはブランチ構造ごとpushするわけではない。 pushは指定したローカルなブランチとリモートにあるブランチとの間で行われる。 リモートリポジトリのmaster以外のブランチにpushしたい場合は明示的にpush先のブランチ指定する必要がある。push先のブランチを指定してpushするには、 % git push : のようにする。 送信先のリポジトリを指定するのが面倒なので、 % git push branch:branch #bad example のように書いてみたが駄目だった。 Gitでは、clone元のことをoriginと呼んでいるようなので、 % git push origin branch:branch #ok のように書いてみるとこれは通るよう。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Leave a reply

[sed] 全角英数を半角にする

あるテキストファイルの全角英数を半角英数に変換する必要があった。 文字ごとの置換には sed の y 関数を使う。 sed ‘y/置換する文字*/置換後の文字*/’ として、置換する文字と対応する置き換え先の文字を列挙する。 % sed ‘y/ABCDEFGHIJKLMNOPQRSTUVWXYZ¥ abcdefghijklmnopqrstuvwxyz0123456789/¥ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789/’¥ input.txt > output.txt のようにすれば、全角英数を半角英数に置換できる。


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , , | Leave a reply

[Scheme] 束縛する値を省略できるように let を書き換える

Common Lisp では CL-USER> (let (a b c) c) NIL のように let で束縛する値を省略できる. 省略された変数は nil に束縛される. しかし,Scheme にはそのような省略記法はない. そこで,マクロを使い Common Lisp のような略記法を導入する. 次のように書く. (define-syntax old-let let) (define-syntax %let (syntax-rules () ((_ (te …) () body …) (old-let (te …) body Continue reading [Scheme] 束縛する値を省略できるように let を書き換える


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , | Leave a reply

[Mac][Carbon Emacs] site-lisp の場所

Carbon Emacsの site-lisp の場所は Application 下においている場合は /Applications/Emacs.app/Contents/Resources/site-lisp/ にある. Finder からは Emacs パッケージを Command + Click すると,ドロップダウンメニューに「パッケージの内容を表示」というのがあるので,それを選ぶとパッケージ内が Finder で開ける. そこから,Contents/Resources/site-lisp/ とたどる. 参考 Emacsの初期設定ファイル


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , , | Leave a reply

[Common Lisp][Emacs] lisp-modeでの字下げを調整する

cl-indent.el を導入すると特別な字下げをする形式や関数を簡単に追加できる。 site-lisp などの path の通った場所に cl-indent.el を置き,.emacs に (require ‘cl-indent) (setq lisp-indent-function (function common-lisp-indent-function)) と書くと導入できる。 字下げする形式を追加するには define-cl-indent 関数を使う。 例えば, sunless を追加するには .emacs 内に, (define-cl-indent ‘(sunless . unless)) のように書く。 (x . y) と書くと x が y の別名になるよう。 cl-indent.el 内には (unless Continue reading [Common Lisp][Emacs] lisp-modeでの字下げを調整する


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , , , | Leave a reply

Google日本語入力で簡単に矢印記号を入力する

Google日本語入力で「z」に続いて vi のカーソル移動のコマンドに対応する h, j, k l を入力すると,vi でカーソルが移動する方向と対応する矢印記号に変換される. 具体的には, z h : ← z j : ↓ z k : ↑ z l : → のように変換される.便利.


Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/category.php on line 383
Posted in コンピュータ | Tagged , | Leave a reply