This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (byte-compile-file "test.l") | |
| ;=> Compiling hoge... | |
| ; done. | |
| ; t | |
| (load "test.lc") | |
| ;=> t | |
| (hoge) | |
| ;=> (4 5 6 7 8 9 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;; xyzzy | |
| (loop | |
| for i from 0 to 2 | |
| unless (< i 1) | |
| return i) | |
| Invalid clause for inside a conditional: return | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun package-iterator (package-list &rest symbol-type) | |
| (when (endp symbol-type) | |
| (error "symbol-typeが指定されていません")) | |
| (when (atom package-list) | |
| (setf package-list (list package-list))) | |
| (let (current-symbols) | |
| #'(lambda () | |
| (when (or current-symbols | |
| symbol-type) | |
| (unless current-symbols |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; バッファ内の Common Lisp の特殊文字を xyzzy Lisp 用に変換する | |
| ;; | |
| ;; 対応表: | |
| ;; | |
| ;; Common Lisp xyzzy Lisp char-code | |
| ;; -------------------------------------- | |
| ;; #\Backspace #\C-h 8 | |
| ;; #\Tab #\TAB 9 | |
| ;; #\Newline #\LFD 10 | |
| ;; #\Linefeed #\LFD 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; xyzzy の calc.l を使って中置記法から前置記法(ポーランド記法)への変換 | |
| ;; | |
| ;; 参考: | |
| ;; | |
| ;; 中置記法から前置記法(ポーランド記法)への変換 - sketch code | |
| ;; http://d.hatena.ne.jp/ibaza/20070602/1180762871 | |
| ;; based on ed::calc-string | |
| (defun infix->prefix (string) | |
| (let ((*read-default-float-format* 'double-float) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; なんちゃって全画面表示モード for xyzzy | |
| ;; | |
| ;; - M-x toggle-fullscreen-mode | |
| ;; - [表示] メニュー - [全画面表示] | |
| ;; - メニューとコマンドバーも非表示にする | |
| ;; - カーソルを画面上部に移動させるとメニューを表示する | |
| ;; - ミニバッファ、ステータスバーは非表示にできない | |
| ;; - モードライン、ルーラー、ステータスバー、行番号などはそのまま | |
| ;; - こいつらも消して広くできるけど、さすがに不便だよね | |
| ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #| | |
| Gauche の c-wrapper のように C のソースから直接 FFI の定義を生成するマクロ。 | |
| まだ、関数と構造体と列挙型だけ。 | |
| (c:define-c-type (winapi:BYTE *) LPBYTE) | |
| (define-c-struct-wrapper " | |
| typedef struct _PROCESS_INFORMATION { | |
| HANDLE hProcess; // プロセスのハンドル | |
| HANDLE hThread; // プライマリスレッドのハンドル |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 以下のコードで si:unpack-string の時点で xyzzy がクラッシュする。 | |
| ;; | |
| ;; - offset を指定しない場合や nil の場合はクラッシュしない | |
| ;; - offset の値は何でもいい | |
| ;; | |
| ;; offset を指定された場合に chunk が nil の場合は、si:make-chunk の時点でエラーにするように | |
| ;; 引数をチェックするとかかな。 | |
| (let ((chunk nil) | |
| (offset 100)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #| | |
| テスト | |
| (progn | |
| (call-process "dir" :show :hide) | |
| (call-process "date" :show :hide) | |
| (get-child-processes)) | |
| ;=> (#S(process-entry exe-file "dir.exe" process-id 1188 parent-process-id 4660 | |
| module-id 0 default-heap-id 0 threads 1 | |
| pri-class-base 8 usage 0 flags 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; xl-critic でバイトコンパイルするとエラーになる原因は | |
| ;; destructuring-bind 内で使っている lambda マクロが原因? | |
| ;; clisp だと動くので xyzzy のどっかのバグ? | |
| (defun test1 () | |
| (let ((a 1)) | |
| ((lambda () a)))) | |
| ;=> test1 | |
| (test1) | |
| ;=> 1 |