[Lisp] Common LispとSchemeの関数対応表

Common Lispの関数やマクロと対応する機能を持つSchemeの手続きや構文を表にまとめる. 随時更新. Common Lisp Scheme 備考 atom なし (not (pair? obj))を使う consp pair? dolist for-each 記法は異なる mapcan append-map!  SRFI 1 mapcar map multiple-value-bind receive SRFI 8, library syntax null null? nth list-ref nthcdr list-tail SRFI 1ではdrop progn begin rplaca set-car! Continue reading [Lisp] Common Lispと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] 束縛する値を省略できるように 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

[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

[Common Lisp] [Allegro] IDEを起動しない

Windows 版 Allegro Common Lisp で SLIME から使う場合など IDE を起動したくない場合は, IDE を起動しないイメージファイルを用意する。 イメージファイルは build-lisp-image 関数で作成する。トップレベルから, CG-USER(1): (require :build) NIL CG-USER(2): (build-lisp-image “no-ide.dxl” :include-ide nil :restart-init-function nil) done. T とすると no-ide.dxl という名前のイメージファイルが作成される。 :restart-init-function パラメータには起動時に初期化のために呼び出す関数名を指定する。 これに, cg:start-ide が指定されていたので, IDE が起動していた。 よって, nil Continue reading [Common Lisp] [Allegro] IDEを起動しない


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] 関数が定義されているか

シンボルに対応する関数が定義されているかは fboundp 関数で調べる。 CL-USER> (defun foo (x y) (+ x y)) FOO CL-USER> (fboundp ‘foo) T CL-USER> (fboundp ‘bar) NIL


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] intern と symbol-name

intern は印字名に対応するシンボルを得る関数。 逆に、シンボルの印字名を得るには symbol-name 関数を用いる。 下の concat-symbol は「2つのシンボルの各印字名を連結した印字名をもつシンボル」を返す関数。 (defun concat-symbol (x y) (intern (concatenate ‘string (symbol-name x) (symbol-name y)))) CL-USER> (concat-symbol ‘x ‘y) XY NIL


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] リストの複製

毎回忘れて再発明しそうになるが、Common Lisp にはリストを複製する関数 copy-tree がある。 CL-USER> (let ((lst ‘(a b c))) (eq lst (copy-tree lst))) NIL


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] コマンドライン引数を取得

Common Lisp ではコマンドライン引数を取得する方法は処理系依存らしい。 Steel Bank Common Lisp (SBCL) の場合は *posix-argv* に文字列のリストの形で代入されている。 Allegro Common Lisp (ACL) の場合は system パッケージの command-line-arguments 関数で取得できる。 『KMRCLを眺める(184) COMMAND-LINE-ARGUMENTS』 によると、(apropos ‘argv) として ‘argv で関数の説明文を検索すれば処理系毎の方法が見つかることが多いとのこと。


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