Re: Racket koans module language bug

Matthew Butterick <[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <[email protected]>
> On Aug 26, 2018, at 5:15 PM, Sage Gerard <[email protected]> wrote:
> 
> The intent is to reject code with blanks, and to treat code without blanks as Racket code that still might not compile


There's more than one way to go about it, of course. It could be simpler to make a wrapper around the usual `read-syntax` and inspect the individual syntax objects as they pass by:


;;;;;;;;;;;;;;;;;; "racket-koans-lang.rkt"

#lang racket
(require syntax/strip-context rackunit)
(provide #%module-begin (except-out (all-from-out racket) read-syntax)
         (rename-out [koan-read-syntax read-syntax])
         (all-from-out rackunit))

(define (koan-read-syntax path ip)
  (define stxs (parameterize ([current-input-port ip])
                 (for/list ([stx (in-port read-syntax)])
                           (when (memq '_____ (flatten (syntax->datum stx)))
                             (raise-syntax-error 'koans "blanks detected" stx))
                           stx)))
  (strip-context
   (with-syntax ([(STX ...) stxs])
     #'(module _ "racket-koans-lang.rkt"
         STX ...))))

-- 
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.