[racket] Define-type language form, and macros

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sun Sep 11 14:04:42 EDT 2011

On Sun, Sep 11, 2011 at 1:44 PM, Jeremy Kun <kun.jeremy at gmail.com> wrote:
> Is there an existing Racket analogue for the "define-type" language form
> from the PLAI text? Is there a quick way for me to just (require-syntax
> define-type) so I can use it in my otherwise purely-Racket programs? Or
> perhaps, is there a way for me to look at the original syntax definitions so
> I can puzzle over how it's done?

Yes, see the docs here:

#lang racket
(require plai)
(define-type N [Zero] [Succ (n N?)])
(Succ (Succ (Zero)))

Here's the source:

> On another note, is there a nice way for me to print out the literal expansion performed by define-syntax?

You really want to use the Macro Stepper.
sam th
samth at ccs.neu.edu

Posted on the users mailing list.