[racket-dev] [racket] Something funky about the expansion of case?...

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Mon Mar 12 17:12:57 EDT 2012

`evcase' is currently provided by `mzlib/etc'.

Should we provide it in `racket' as well?

Vincent



At Mon, 12 Mar 2012 16:53:14 -0400,
Matthias Felleisen wrote:
> 
> 
> see evcase 
> 
> 
> On Mar 12, 2012, at 4:45 PM, Rüdiger Asche wrote:
> 
> > Hi there,
> > 
> > why is the Zero alias replaced correctly in every form in the expression except the case branch where it is inserted as a literal?
> > 
> > --------------------------------------------------------------------------------------------
> > (require macro-debugger/stepper-text)
> > (expand/step-text
> > 
> > #'(let ()
> > 
> > (define-syntax alias
> >                   (syntax-rules ()
> >                    [(_ symbol literal)
> >                       (define-syntax symbol (syntax-id-rules () [symbol literal]))
> >                    ]))
> > 
> > 
> > (alias Zero 0)
> > (alias One 1)
> > 
> > (letrec (
> >              (dummyfn (lambda (c)  ;;
> >                                   (case c
> >                                       [(Zero)
> >                                        One
> >                                       ]
> >                                    )
> >               ))
> >       )
> >        (if Zero One 2)
> >        (if (eqv? '2 Zero) 4 5)
> >        (dummyfn Zero)
> >  )
> > ))
> > 
> > --------------------------------------------------------------------------------------------
> > 
> > ==>
> > 
> > (let-values:1
> > ()
> > (let-values
> > ()
> > (letrec-values:37
> >  (((dummyfn)
> >    (lambda:39
> >     (c)
> >     (if:40
> >      (#%app:41 eqv?:41 c 'Zero)
> >      (let-values:40 () '1)
> >      (#%app:40 void:40)))))
> >  (if '0 '1 (quote 2))
> >  (if (#%app:45 eqv? '2 '0) (quote 4) (quote 5))
> >  (#%app:47 dummyfn '0))))
> > 
> > Thanks.
> > 
> > 
> > 
> > ____________________
> > Racket Users list:
> > http://lists.racket-lang.org/users
> 
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the dev mailing list.