PasteRack.org
Paste # 88938
2017-10-11 01:11:05

Fork as a new paste.

Paste viewed 74 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:10:0: read: expected a `)' to close `('
  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/88938/88938code.scrbl: [running body]
   loop
   ...cket/cmdline.rkt:179:51
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/run.rkt: [running body]