Skip to content

Instantly share code, notes, and snippets.

@miyamuko
Created May 30, 2011 03:36

Revisions

  1. miyamuko revised this gist May 30, 2011. 1 changed file with 28 additions and 0 deletions.
    28 changes: 28 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -25,3 +25,31 @@
    ;=> test2
    (test2)
    1




    ;; 逆アセンブルした結果


    Function test1:
    stack frame max: 1
    stack depth max: 1
    argument list: nil
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3: CONSTANT 1
    4: local-set-discard LOCALVAR-1
    6: call-0 (lambda nil a)
    8: RET

    Function test2:
    stack frame max: 1
    stack depth max: 1
    argument list: nil
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3: CONSTANT 1
    7: lexical-bind 14, (a)
    8: lexical-set-discard a
    10: make-closure (lambda nil a)
    12: funcall 1
    14: RET
  2. miyamuko created this gist May 30, 2011.
    27 changes: 27 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    ;; xl-critic でバイトコンパイルするとエラーになる原因は
    ;; destructuring-bind 内で使っている lambda マクロが原因?
    ;; clisp だと動くので xyzzy のどっかのバグ?

    (defun test1 ()
    (let ((a 1))
    ((lambda () a))))
    ;=> test1
    (test1)
    ;=> 1
    (compile 'test1)
    ;=> test1
    (test1)
    ;=> 変数が定義されていません: a



    (defun test2 ()
    (let ((a 1))
    (funcall #'(lambda () a))))
    ;=> test2
    (test2)
    ;=> 1
    (compile 'test2)
    ;=> test2
    (test2)
    1