[racket] structure question

From: andrew cooke (andrew at acooke.org)
Date: Wed Dec 8 07:54:24 EST 2010

Manfred Lotz <manfred.lotz at ...> 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 use field names like in the example above. Can I do this in
> racket?

I may be misunderstanding, but are "keywords" what you are looking for?
http://docs.racket-lang.org/guide/keywords.html

>From that page:
"Keywords are intended for use (unquoted) as special markers in argument lists
and in certain syntactic forms"

(I am new to Racket and just reading through the docs)

Andrew



Posted on the users mailing list.