PasteRack.org
Paste # 62028
2017-10-11 01:10:40

Fork as a new paste.

Paste viewed 180 times.


Embed:

Bad Matching

#lang racket

(define (mm e)
    (match e
      [`(let ([,xs ,es] ...) ,body ...) body]
      [_ 'else]))


(mm '(let ([a 1]) a a) ==> returns '(a a). good!
(mm '(let ([a 1]) a) ==> returns '(a), can i make it return 'a ?

=>

prog:9:41: read: illegal use of `.'
  context...:
   /home/pasterack/racket68/collects/syntax/module-reader.rkt:186:17: body
   /home/pasterack/racket68/collects/syntax/module-reader.rkt:183:2: wrap-internal
   /home/pasterack/racket68/collects/racket/../syntax/module-reader.rkt:65:9: lang:read-syntax
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/private/manual-code.rkt:112:0: get-tokens
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/private/manual-code.rkt:56:0: typeset-code15
   /home/pasterack/pasterack/tmp/62028/62028code.scrbl: [running body]
   loop
   ...cket/cmdline.rkt:179:51
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/run.rkt: [running body]