[racket] metacircular interpreter: recursive macro expanding order ==> Re: metacircular interpreter: macro parser

2010-12-07 Thread YC
Hi all - I have now implemented the pattern matching/transforming algorithm of a macro expander (no hygiene yet) for a single macro expansion call. The next step is to figure out how to apply the macro expanders recursively "in order". For example, let's say we want to expand the following: (or

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

[racket] structure question

2010-12-07 Thread Manfred Lotz
Hi there, 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 li

Re: [racket] inherit and apply

2010-12-07 Thread Matthew Flatt
At Wed, 1 Dec 2010 20:52:47 +, Stephen De Gabrielle wrote: > I'm getting an error when I try to use 'apply' on an inherited method: > > colourwell.rkt:60:47: class: misuse of method (not in application) in: set > > I feel I've missed something in my reading of the reference manual for apply

Re: [racket] Scribble: Different output for LaTeX and HTML backends

2010-12-07 Thread Sam Tobin-Hochstadt
On Tue, Dec 7, 2010 at 11:30 AM, Matthias Felleisen wrote: > > Define a Scribble function like this: > > (define (exact . items) >  (make-element (make-style "identity" '(exact-chars)) >                items)) > (provide exact) This relies on a Latex macro named \identity being defined earlier in

Re: [racket] Scribble: Different output for LaTeX and HTML backends

2010-12-07 Thread Matthias Felleisen
Define a Scribble function like this: (define (exact . items) (make-element (make-style "identity" '(exact-chars)) items)) (provide exact) In your document, write @no...@exact{\raggedright Schelog (1993) \url{http://docs.racket-lang.org/racklog}}} -- Matthias On Dec

Re: [racket] Scribble: Different output for LaTeX and HTML backends

2010-12-07 Thread Jens Axel Søgaard
In the HTML output, can I do more than just choose a new CSS style? (If yes, can you point to the proper place in the manual?) I know how to change the styles in the CSS file, but for the embedding code below, I need to output HTML too. Ideally, I'd like to write something a la: @html/pdf{}{} wh

Re: [racket] Scribble: Different output for LaTeX and HTML backends

2010-12-07 Thread Robby Findler
You can just set up a new command and give it different implementations in a style.tex and for the HTML output. There is a section on this in the docs I believe. Robby On Tuesday, December 7, 2010, Jens Axel Søgaard wrote: > Hi All, > > I have a YouTube video, that I'd like to embed in the HTML

[racket] Scribble: Different output for LaTeX and HTML backends

2010-12-07 Thread Jens Axel Søgaard
Hi All, I have a YouTube video, that I'd like to embed in the HTML output using the following code: http://www.youtube.com/embed/J3WIPS3Uh_A?rel=0"; frameborder="0"> In the PDF version, I'd like to use: @hyperlink["http://www.youtube.com/watch?v=J3WIPS3Uh_A"]{Proof for the cosine relation in an

Re: [racket] Value Extraction from Lists vs. Structures

2010-12-07 Thread Matthias Felleisen
Here is an expansion on Noel's answer. When the compiler sees a (struct book (author title)) it creates code that allocates a vector of three words: -- one that says "I am not a vector, but a book struct" -- one that holds the author value -- one that holds the title value The functio

Re: [racket] read text file

2010-12-07 Thread Matthias Felleisen
On Dec 6, 2010, at 11:35 PM, Eli Barzilay wrote: > Three minutes ago, prad wrote: >> On Mon, 6 Dec 2010 19:48:14 -0700 >> Jay McCarthy >> wrote: >> >>> Try file->string >>> >> thx jay and sam! >> file->string works very nicely for what i'm doing, but i'll check the >> read-all out later. inte

Re: [racket] regexp-replace* with input-port ==> Re: multi-replace function

2010-12-07 Thread Eli Barzilay
15 minutes ago, YC wrote: > On Tue, Dec 7, 2010 at 12:25 AM, Eli Barzilay wrote: > > > > Actually, there's a problem -- there is already an optional > > argument for the prefix, and if an output port is added, it should > > be added before that for consistency but that will be > > incompatible. >

Re: [racket] regexp-replace* with input-port ==> Re: multi-replace function

2010-12-07 Thread YC
On Tue, Dec 7, 2010 at 12:25 AM, Eli Barzilay wrote: > > Actually, there's a problem -- there is already an optional argument > for the prefix, and if an output port is added, it should be added > before that for consistency but that will be incompatible. That's unfortunate. Looking at v4.2.5 I

Re: [racket] regexp-replace* with input-port ==> Re: multi-replace function

2010-12-07 Thread Eli Barzilay
10 minutes ago, YC wrote: > On Mon, Dec 6, 2010 at 11:49 PM, Eli Barzilay wrote: > > > Well, that would be an obvious issue... It might be possible to > > do this if they're extended to get an output port too, something > > like: > > > > (regexp-replace* #rx"foo" inp "bar" outp) > > > > doing t

Re: [racket] regexp-replace* with input-port ==> Re: multi-replace function

2010-12-07 Thread YC
On Mon, Dec 6, 2010 at 11:49 PM, Eli Barzilay wrote: > > Well, that would be an obvious issue... It might be possible to do > this if they're extended to get an output port too, something like: > > (regexp-replace* #rx"foo" inp "bar" outp) > > doing the same thing as the loop that I wrote. So