Re: [racket] Macros and literal-id

2011-08-09 Thread Jos Koot
; Prabhakar Ragde; users@racket-lang.org Subject: Re: [racket] Macros and literal-id Are you sure that's what he meant? When I am writing syntax-rules, I often recurse when attempting to recur. RAC On Aug 9, 2011, at 11:30 AM, Jos Koot wrote: > I enjoyed glancing through your links. In the f

Re: [racket] Macros and literal-id

2011-08-09 Thread Neil Van Dyke
Jos Koot wrote at 08/09/2011 01:30 PM: In the first one I saw the word 'recurse'. I think you ment 'recur', not 'curse again' :) That, I submit, is evidence in support of my original assertion. Wrangling "syntax-rules" consumed all my meager IQ points, leaving none for other concerns, lik

Re: [racket] Macros and literal-id

2011-08-09 Thread Richard Cleis
7;recur', not 'curse again' :) > Jos > > -Original Message- > From: users-boun...@racket-lang.org [mailto:users-boun...@racket-lang.org] > On Behalf Of Neil Van Dyke > Sent: martes, 09 de agosto de 2011 19:02 > To: Prabhakar Ragde > Cc: users@racket-lang

Re: [racket] Macros and literal-id

2011-08-09 Thread Jos Koot
: martes, 09 de agosto de 2011 19:02 To: Prabhakar Ragde Cc: users@racket-lang.org Subject: Re: [racket] Macros and literal-id Prabhakar Ragde wrote at 08/09/2011 12:05 PM: > Neil Van Dyke wrote: > >> The hardest macro tasks, in "syntax-rules", >> become opportunities t

Re: [racket] Macros and literal-id

2011-08-09 Thread Neil Van Dyke
Prabhakar Ragde wrote at 08/09/2011 12:05 PM: Neil Van Dyke wrote: The hardest macro tasks, in "syntax-rules", become opportunities to show off how well one can do scary-looking CPS that's really expensive at expansion time. For my edification, as well as that of other macro newbies, can you

Re: [racket] Macros and literal-id

2011-08-09 Thread Robby Findler
The word 50 version is that syntax-rules only allows a limited form of pattern rewriting, but syntax-case lets you write arbitrary functions that rewrite the syntax. A big reason for this being important is that you can write better error messages, but there are other things too, of course. On Tue

Re: [racket] Macros and literal-id

2011-08-09 Thread Prabhakar Ragde
Neil Van Dyke wrote: The hardest macro tasks, in "syntax-rules", become opportunities to show off how well one can do scary-looking CPS that's really expensive at expansion time. For my edification, as well as that of other macro newbies, can you give some examples of this, and how syntax-cas

Re: [racket] Macros and literal-id

2011-08-09 Thread Neil Van Dyke
Richard Cleis wrote at 08/09/2011 10:25 AM: What is the reason for using syntax-rules instead of syntax-parse? (To maintain RnRs compatibility?) I use it for historical reasons, from when I learned it in RnRS. For people new to Racket, I will probably be nudging them towards something ot

Re: [racket] Macros and literal-id

2011-08-09 Thread Vincent St-Amour
At Tue, 09 Aug 2011 08:25:14 -0600, Richard Cleis wrote: > What is the reason for using syntax-rules instead of syntax-parse? > (To maintain RnRs compatibility?) When simple pattern-matching and templating can express what you want, syntax-rules (and even define-syntax-rule) is great and very easy

Re: [racket] Macros and literal-id

2011-08-09 Thread Richard Cleis
What is the reason for using syntax-rules instead of syntax-parse? (To maintain RnRs compatibility?) RAC On Aug 9, 2011, at 8:15 AM, Neil Van Dyke wrote: > BTW, for future readers... in this example: > > (define-syntax if* > (syntax-rules (then else) > ((_ ?test (then ?consequent) (else ?al

Re: [racket] Macros and literal-id

2011-08-09 Thread Neil Van Dyke
BTW, for future readers... in this example: (define-syntax if* (syntax-rules (then else) ((_ ?test (then ?consequent) (else ?alternate)) (if ?test ?consequent ?alternate The "?" part of the pattern variables is just a naming convention of individual programmers. The "?" is the firs

Re: [racket] Macros and literal-id

2011-08-09 Thread Matthias Felleisen
Notice that the program below works in our primary language, #lang racket, just as well. -- Matthias On Aug 9, 2011, at 2:40 AM, Marco Maggi wrote: > #!r6rs > (import (except (rnrs) else)) > > (define-syntax if* > (syntax-rules (then else) >((_ ?test (then ?consequent) (else ?alternate)

Re: [racket] Macros and literal-id

2011-08-08 Thread Marco Maggi
Marco Maggi wrote: > verify that the components of the input macro falling in the ^^^ Sorry, it should be "input form" there. -- Marco Maggi _ For list-related administrative tasks

Re: [racket] Macros and literal-id

2011-08-08 Thread Marco Maggi
Harry Spier wrote: > And if not, would it be possible for someone to give a > simple example of its use. I will use R6 Scheme here. Scheme defines the IF syntax as: (if ?test ?consequent ?alternate) where the only "language keyword" is IF itself. Many other languages use a version wi

Re: [racket] Macros and literal-id

2011-08-08 Thread Asumu Takikawa
On 2011-08-09 01:15:01 -0400, Harry Spier wrote: >Are there any actual examples in the on-line documentation (guide or >reference) showing the use of "literal-id" in a syntax-rules statement. >I.e. in: >(define-syntax id > (syntax-rules (literal-id ...) >[pattern templa

[racket] Macros and literal-id

2011-08-08 Thread Harry Spier
Dear list members, Are there any actual examples in the on-line documentation (guide or reference) showing the use of "literal-id" in a syntax-rules statement. I.e. in: (define-syntax id (syntax-rules (literal-id ...) [pattern template] ...)) And if not, would it be possible for some