Re: [racket] structure question

2011-03-19 Thread Manfred Lotz
On Sat, 19 Mar 2011 10:10:15 -0400 Matthias Felleisen wrote: > > Read delivers an S-expression. You need to turn it into a structure > again > Aaah, ok. I see. -- Thanks, Manfred _ For list-related administrative tasks: http://lists.r

Re: [racket] structure question

2011-03-19 Thread Matthias Felleisen
Read delivers an S-expression. You need to turn it into a structure again On Mar 19, 2011, at 5:29 AM, Manfred Lotz wrote: > On Wed, 8 Dec 2010 16:13:08 -0500 > Matthias Felleisen > wrote: > > >> ;; >> - >> ;; >> us

Re: [racket] structure question

2011-03-19 Thread Manfred Lotz
On Wed, 8 Dec 2010 16:13:08 -0500 Matthias Felleisen wrote: > ;; > - > ;; > usage example (could be separate module) (define detail-default "?") > (struct/kw book (author title [details detail-default]) #:transparent) >

Re: [racket] structure question

2010-12-09 Thread Manfred Lotz
On Wed, 8 Dec 2010 16:13:08 -0500 Matthias Felleisen wrote: > > > > Here is a version with 'type' annotations that should be easier to > read and learn from. > > #lang racket > > ;; > - > ;; > library module > >

Re: [racket] structure question

2010-12-08 Thread Matthias Felleisen
Here is a version with 'type' annotations that should be easier to read and learn from. #lang racket ;; - ;; library module ;; syntax def ;; definition = ... | (struct/kw name (field ...) options ...) ;; meaning:

Re: [racket] structure question

2010-12-08 Thread Manfred Lotz
On Wed, 8 Dec 2010 14:39:52 -0500 Matthias Felleisen wrote: > > > > #lang racket > > ;; > - > ;; > library module > > ;; syntax def > ;; definition = ... | (struct/kw name (field ...) options ...) > ;; meaning:

Re: [racket] structure question

2010-12-08 Thread Matthias Felleisen
#lang racket ;; - ;; library module ;; syntax def ;; definition = ... | (struct/kw name (field ...) options ...) ;; meaning: (struct name (field ...) options ...) ;; plus keyword-based c

Re: [racket] structure question

2010-12-08 Thread Manfred Lotz
On Wed, 8 Dec 2010 10:25:47 -0500 Matthias Felleisen wrote: > > #lang racket > > ;; > - > ;; > library module > > ;; syntax def > ;; definition = ... | (struct/kw name (field ...) options ...) > ;; meaning:

Re: [racket] structure question

2010-12-08 Thread Matthias Felleisen
#lang racket ;; - ;; library module ;; syntax def ;; definition = ... | (struct/kw name (field ...) options ...) ;; meaning: (struct name (field ...) options ...) ;; plus keyword-based con

Re: [racket] structure question

2010-12-08 Thread andrew cooke
Manfred Lotz writes: > In Common Lisp I can define something like this: > (defvar *db* nil) > (defun make-book (&key author title) > (list :author author :title title)) > (defun add-record (book) (push book *db*)) > (add-record (make-book :author "John Grisham" :title "The Client")) > I like to

Re: [racket] structure question

2010-12-07 Thread Manfred Lotz
On Wed, 08 Dec 2010 00:20:13 -0500 Neil Van Dyke wrote: > Manfred Lotz wrote at 12/07/2010 11:51 PM: > [...] > > (add-record (make-book :author "John Grisham" :title "The Client")) > > > > I like to use field names like in the example above. Can I do this > > in racket? > > What I have done mo

Re: [racket] structure question

2010-12-07 Thread Neil Van Dyke
Manfred Lotz wrote at 12/07/2010 11:51 PM: [...] (add-record (make-book :author "John Grisham" :title "The Client")) I like to use field names like in the example above. Can I do this in racket? What I have done most recently is to define a struct with a low-level constructor with positional