Re: [racket] Problem with macro

2012-09-02 Thread Harry Spier
Thanks Danny, I've changed the syntax of the macro as follows by faking keyword arguments prompt: and handler: and it works now as far as I can tell. I saw some discussion on the dev list about keyword parameters and syntax but I didn't quite follow it, so I wasn't sure if it was saying that keyw

Re: [racket] Problem with macro

2012-09-01 Thread Harry Spier
Thanks Danny, Its obvious now that you point it out. On Sun, Sep 2, 2012 at 12:27 AM, Danny Yoo wrote: >> (let/set-prompt prompt-3 () >> (+ 1000 >>(abort-to-prompt p 0) >>2000)) >> >> ==> >> >> (call-with-continuation-prompt >> (let () (λ

Re: [racket] Problem with macro

2012-09-01 Thread Danny Yoo
> (let/set-prompt prompt-3 () > (+ 1000 >(abort-to-prompt p 0) >2000)) > > ==> > > (call-with-continuation-prompt > (let () (λ () >+ >1000 >(abort-to-prompt p 0) >2000)) > prompt-3) > > > > And

Re: [racket] Problem with macro

2012-09-01 Thread Danny Yoo
> So I tried modifying the macro to the following. > > ;(let/set-prompt args prompt (body ...)) > (define-syntax let/set-prompt > (syntax-rules () > [(_ARGS (BODY ...)) (call-with-continuation-prompt > (let ARGS (λ () BODY ...)))] > [(_ PROMPT ARGS (BODY ...)) (cal

[racket] Problem with macro

2012-09-01 Thread Harry Spier
Dear list members, I'm trying to work my way through Racket continuations by going through the Guide and Reference. And as part of that I set up small examples and sometimes macros to simplify the syntax so I can see more clearly whats going on. So I made a let type form of call-with-continuatio

Re: [racket] Problem with macro

2011-08-12 Thread Grant Rettke
2011/8/12 Racket Noob : > It's a sad thing that I cannot find a book or text as clear as PG's "On > Lisp" that covers Racket's hygienic macros in such detailed manner. :( Be sure to read TSPL's section on syntax-rules and syntax-case and work through all of the problems. _

Re: [racket] Problem with macro

2011-08-12 Thread Danny Yoo
2011/8/12 Racket Noob : > Thank you, beautiful people! > > I'll take a look at Dybvig's article. Also: http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html Hmmm... we need some consolidation. This material belongs in the Guide. __

Re: [racket] Problem with macro

2011-08-12 Thread Racket Noob
Racket Noob > Date: Fri, 12 Aug 2011 11:05:30 -0500 > Subject: Re: [racket] Problem with macro > From: clkl...@eecs.northwestern.edu > To: d...@cs.wpi.edu > CC: racketn...@hotmail.com; users@racket-lang.org; ro...@eecs.northwestern.edu > > On Fri, Aug 12, 2011 at 10:44 A

Re: [racket] Problem with macro

2011-08-12 Thread Casey Klein
On Fri, Aug 12, 2011 at 10:44 AM, Danny Yoo wrote: > Kent Dybvig's tutorial on syntax case was helpful for me: > >    http://www.cs.indiana.edu/~dyb/pubs/tr356.pdf > I second that recommendation. It was a huge help to me when learning to write macros in Racket. __

Re: [racket] Problem with macro

2011-08-12 Thread Danny Yoo
> Oh, that's my problem: i obviously don't understand what's the places where > macro expansion happens. > I ended up writing "classical" lisp non-hygienic macro instead. > >  It's a sad thing that I cannot find a book or text as clear as PG's "On > Lisp" that covers Racket's hygienic macros in suc

Re: [racket] Problem with macro

2011-08-12 Thread Carson Chittom
Neil Van Dyke writes: > (Pardon the writing in enumerations, but someone erroneously put caf > coffee in the decaf coffee carafe.) Say *that* ten times fast. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] Problem with macro

2011-08-12 Thread Casey Klein
On Fri, Aug 12, 2011 at 9:22 AM, Neil Van Dyke wrote: > 1. Without trying it, I'm pretty sure this particular syntax transformation > can be done in "syntax-rules", but I'm not certain it can be done using only > the power of "..." in "syntax-rules", without a helper macro.  Your life > might be e

Re: [racket] Problem with macro

2011-08-12 Thread Racket Noob
27;r) endstate Shriram's approach (described here: http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf ) forces us to give input all in one take. Racket Noob > Date: Fri, 12 Aug 2011 10:22:18 -0400 > From: n...@neilvandyke.org > To: racketn.

Re: [racket] Problem with macro

2011-08-12 Thread Neil Van Dyke
1. Without trying it, I'm pretty sure this particular syntax transformation can be done in "syntax-rules", but I'm not certain it can be done using only the power of "..." in "syntax-rules", without a helper macro. Your life might be easier if you do this particular transformation in "syntax-c

Re: [racket] Problem with macro

2011-08-12 Thread Racket Noob
that covers Racket's hygienic macros in such detailed manner. :( Racket Noob > Date: Fri, 12 Aug 2011 07:39:16 -0500 > Subject: Re: [racket] Problem with macro > From: ro...@eecs.northwestern.edu > To: clkl...@eecs.northwestern.edu > CC: jay.mccar...@gmail.com; users@racket-l

Re: [racket] Problem with macro

2011-08-12 Thread Robby Findler
On Fri, Aug 12, 2011 at 7:49 AM, Casey Klein wrote: > On Fri, Aug 12, 2011 at 7:39 AM, Robby Findler > wrote: >> Unfortunately, that position in a 'case' expression is not a place >> where macro expansion happens. You can, however, use a 'cond' instead >> of 'case'. >> > > But you still can't use

Re: [racket] Problem with macro

2011-08-12 Thread Casey Klein
On Fri, Aug 12, 2011 at 7:39 AM, Robby Findler wrote: > Unfortunately, that position in a 'case' expression is not a place > where macro expansion happens. You can, however, use a 'cond' instead > of 'case'. > But you still can't use a macro like `process-state' to generate an entire `cond' claus

Re: [racket] Problem with macro

2011-08-12 Thread Robby Findler
Unfortunately, that position in a 'case' expression is not a place where macro expansion happens. You can, however, use a 'cond' instead of 'case'. Robby On Fri, Aug 12, 2011 at 7:33 AM, Casey Klein wrote: > On Fri, Aug 12, 2011 at 7:26 AM, Jay McCarthy wrote: >> 2011/8/11 Racket Noob : >>> >>>

Re: [racket] Problem with macro

2011-08-12 Thread Casey Klein
On Fri, Aug 12, 2011 at 7:26 AM, Jay McCarthy wrote: > 2011/8/11 Racket Noob : >> >> (define-syntax automaton >>   (syntax-rules (: -> END) >>     [(_ init-state >>     (state : transition ...) >>     ...) >> (letrec ([curr-state empty] >>   [state >>    (lambd

Re: [racket] Problem with macro

2011-08-12 Thread Jay McCarthy
2011/8/11 Racket Noob : > Hi all! > > I want to create macro for creating a DFA automaton (similar to > one described > here: http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf ) > > My desire is that, for example, this form > > (automaton init >    (init : (c ->

[racket] Problem with macro

2011-08-12 Thread Racket Noob
Hi all! I want to create macro for creating a DFA automaton (similar to one described here: http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf ) My desire is that, for example, this form (automaton init (init : (c -> more)) (more : (a -> more)