Skip to content

Instantly share code, notes, and snippets.

@yamasushi
Last active December 17, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamasushi/5519760 to your computer and use it in GitHub Desktop.
Save yamasushi/5519760 to your computer and use it in GitHub Desktop.
>gosh /home/shuji/gauche/debug/test.scm
#?="/home/shuji/gauche/debug/test2.scm":23:(rp-dict)
#?- #<hash-table eq? 0x99230f0>
#?="/home/shuji/gauche/debug/test2.scm":11:(rp-dict)
#?- #<hash-table eq? 0x99230f0>
(1)#?="/home/shuji/gauche/debug/test2.scm":13:(rp-dict)
#?- #f
*** ERROR: (rp-dict) is false
Stack Trace:
_______________________________________
0 (scan-shared obj 0 0)
At line 24 of "/home/shuji/gauche/debug/test2.scm"
(use debug.test2)
(use gauche.generator)
(use gauche.lazy)
($ tt
$ generator->lseq
$ (cut gtake <> 10)
$ generate (^y (y 1)) )
(define-module debug.test2
(use gauche.parameter)
(export tt)
)
(select-module debug.test2)
(define rp-dict (make-parameter #f)) ;table to count shared structure
(define simple-obj---? identity)
(define (simple-obj? x)
#?=(rp-dict)
(write x) (flush)
#?=(rp-dict)
(member x '("") ) )
(define (scan-shared obj level len)
(rp-dict)
(cond [(simple-obj? obj) #f]
[else (unless (rp-dict) (error "(rp-dict) is false") ) ]))
(define (tt obj)
(parameterize ( [rp-dict (make-hash-table 'eq?)] )
#?=(rp-dict)
(scan-shared obj 0 0) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment