PasteRack.org
Paste # 89
2014-01-15 06:34:26

Fork as a new paste.

Paste viewed 837 times.


Embed:

annotate investigation

  1. #lang racket
  2. (begin-for-syntax
  3.  
  4. (require racket/format gui-debugger/annotator)
  5.  
  6. (define (litter-with-printfs stx)
  7.       (let-values ([(annotated breakmap)
  8.                     (annotate-stx (expand stx)
  9.                         (lambda (debug annotated original is-tail?)
  10.                           (printf "BREAK-WRAP call.~ndebug:~n~s~nannotated:~n~s~noriginal:~n~s~nis-tail?~n~s"
  11.                                   debug
  12.                                   annotated
  13.                                   original
  14.                                   is-tail?))
  15.                         (lambda (use-case bound-stx binding-stx)
  16.                           (printf "RECORD-BOUND-ID call.~nuse-case:~n~s~nbound-stx:~n~s~nbinding-stx:~n~s~n"
  17.                                   use-case
  18.                                   bound-stx
  19.                                   binding-stx))
  20.                         (lambda (use-case bound-stx binding-stx)
  21.                           (printf "RECORD-TOP-LEVEL-ID call.~nuse-case:~n~s~nbound-stx:~n~s~nbinding-stx:~n~s~n"
  22.                                   use-case
  23.                                   bound-stx
  24.                                   binding-stx)))])
  25.         annotated)))
  26.  
  27. (define-syntax littered
  28.   (lambda (stx)
  29.     (litter-with-printfs (cadr (syntax->list stx)))))
  30.  
  31. (define a "hi")
  32. (littered (string-append a "lo"))

=>

expr-syntax-object-iterator: unknown expr: (#%app

string-append a (quote lo))