[racket-dev] relationship between define-struct and struct

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Aug 28 15:38:13 EDT 2010

This works fine in #lang racket, eg:

#lang racket
(define-struct s (a b))
(provide (struct-out s))

I think that ASL's define-struct is not racket's tho, so you'd
probably have to read the docs carefully to understand what's
different and what it does and why it is not working properly with
racket's struct-out.

As for the answer to your question at the end, you can just look at
the binding. Here is a start:

#lang racket
(require (prefix-in a: (only-in lang/htdp-advanced define-struct)))
(a:define-struct s (x y))
(define-syntax (m stx)
  (syntax-case stx ()
    [(_ a)
     (printf "~s\n" (syntax-local-value #'a))
(m s)


On Sat, Aug 28, 2010 at 2:23 PM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> What is the relationship between define-struct and struct in Racket
> 5.0.1?  By define-struct I mean the construct provided in ASL.  In my
> custom language I have
> (define-struct tv (tag value))
> (provide (struct-out tv))
> and I get the error
> struct-out: no import for structure-type identifier in: struct:tv
> Is this because define-struct suppresses the struct:tv "structure-type
> information"?  (If so, why?)  ((And if so, is there a way to make
> struct-out work shy of copying the implementation of define-struct and
> adding/removing the line that hides this?))
> Shriram
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.