[plt-scheme] slatex and including unit testable code

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed May 16 11:21:04 EDT 2007

> See also "to-string.ss" in Help Desk.

Oh!  I didn't see that one.  Thanks!

(I wonder if I can de-list syntax-reprinter.plt from being displayed on 
PLaneT since it's a superfluous package.)


One other bug that I have in the definition is that it's not syntax-casing 
properly against the literal word "define".  I'm still a bit inexperienced 
with syntax-case, so I just kludged in the following:

   ;; find-defn: symbol input-port -> (union syntax #f)
   ;; Looks for a defined function in defun-style syntax.
   (define (find-defn name port)
     (let loop ([stx (read-syntax #f port)])
       (cond [(eof-object? stx)
              #f]
             [else
              (syntax-case stx ()
                [(def (name-stx args ...) body ...)
                 (and (symbol? (syntax-e #'name-stx))
                      (symbol=? (syntax-e #'name-stx)
                                name)
                      (symbol? (syntax-e #'def))
                      (symbol=? (syntax-e #'def) 'define))
                 stx]
                [else
                 (loop (read-syntax #f port))])])))

When I have time, I should review why I'm confused and see how to fix this 
correctly.  Sorry about the broken definition, Grant!


Posted on the users mailing list.