Re: [racket] variables within macros

2013-01-23 Thread John Clements
On Jan 19, 2013, at 11:39 AM, Matthias Felleisen wrote: > > -- you need the same abstractions over and over again: this calls for a > library system with proper linguistic support. Contrary to rumors, you can't > really build this support from lambdas and S-expression macros. Is our syntax >

Re: [racket] variables within macros

2013-01-22 Thread Matthias Felleisen
No, I am just saying the very idea was considered brilliant 30 years ago. On Jan 22, 2013, at 3:57 AM, Tim Brown wrote: > On 21/01/13 17:13, Matthias Felleisen wrote: >> Absolutely useful. Note: 30 years ago, this macro was the beginning of >> an ACM award-winning dissertation on "program syn

Re: [racket] variables within macros

2013-01-21 Thread Matthias Felleisen
I have considered adding something like this to the DrRacket teaching languages for HtDP. For an ordinary programmer, this conveys that tests do NOT prove anything but that the function works on the supplied test cases. Absolutely useful. Note: 30 years ago, this macro was the beginning of a

Re: [racket] variables within macros

2013-01-21 Thread Tim Brown
On 21/01/13 05:22, Eli Barzilay wrote: (Ah, and that explains the `define/test'. I don't know what's the time-frame involved, but something that would be more ambitious would be a language where the source code must have enough tests to get complete coverage...) Time frame is the end of the mo

Re: [racket] variables within macros

2013-01-21 Thread Tim Brown
On 20/01/13 22:26, Matthias Felleisen wrote: On Jan 20, 2013, at 6:35 AM, Tim Brown wrote: On Jan 18, 2013, at 12:36 PM, Tim Brown wrote: A concrete example is that I am trying to write a #lang language. Honestly, I would never ever try to write a #lang first. That's more than most people wan

Re: [racket] variables within macros

2013-01-20 Thread Eli Barzilay
12 hours ago, Matthias Felleisen wrote: > > Eli's testing library is in some state of development. Some dev > people are using it. Yes, "some state" is a good description... I had a bunch of revisions that mainly make it easy to create new arrows for different kinds of testing. Three hours ag

Re: [racket] variables within macros

2013-01-20 Thread Asumu Takikawa
On 2013-01-20 17:26:33 -0500, Matthias Felleisen wrote: > (What is that? Link doesn't work.) Here is a working link: http://www.pltgames.com/ It's a programming competition held every month in which the contestants submit an implementation of a programming language that fits some theme. IOW, a

Re: [racket] variables within macros

2013-01-20 Thread Matthias Felleisen
On Jan 20, 2013, at 6:35 AM, Tim Brown wrote: > Below, you use define-syntax-rule. Your example didn't seem to call for more. And define-syntax-rule is just a syntactic extension :-) for defining simplistic syntax extensions. Syntax objects are all under the hood. But you are correct. When

Re: [racket] variables within macros

2013-01-20 Thread Matthias Felleisen
On Jan 20, 2013, at 6:37 AM, Tim Brown wrote: >> On 01/19/2013 06:31 PM, Matthias Felleisen wrote: > [quoting depth out by one] >>> On Jan 18, 2013, at 12:36 PM, Tim Brown wrote: >>> Here is one way to justify this answer. You really may wish to >>> make define/test orthogonal to which testing f

Re: [racket] variables within macros

2013-01-20 Thread Tim Brown
On 01/19/2013 06:31 PM, Matthias Felleisen wrote: [quoting depth out by one] On Jan 18, 2013, at 12:36 PM, Tim Brown wrote: Here is one way to justify this answer. You really may wish to make define/test orthogonal to which testing framework you use: -- rackunit -- test engine -- the Eli

Re: [racket] variables within macros

2013-01-20 Thread Tim Brown
Matthias, Thank you very much for your response. First, in the interests of full disclosure; I found a bug in my code -- there was a missing #` from one of my templates, which I found through luck rather than judgement. It'd be easy to claim that "all them parentheses in Racket just confuse me",

Re: [racket] variables within macros

2013-01-19 Thread Matthias Felleisen
On Jan 18, 2013, at 3:22 PM, Rüdiger Asche wrote: > Scheme used to be plainly beautiful. Understand lambda expressions, recursion > and continuations, and everything else more or less falls into place. Rüdiger, let me take exception to your message in the sense of your email and in the sens

Re: [racket] variables within macros

2013-01-19 Thread Tim Brown
Excuse me everyone, I'm sending this so I can pin responses from another, recently-subscribed-to-the-list account. Tim On 01/19/2013 06:31 PM, Matthias Felleisen wrote: Let's take a step at a time. Don't lose patience. It will help you get where you want to be, and it may help us figure out ho

Re: [racket] variables within macros

2013-01-19 Thread Matthias Felleisen
Let's take a step at a time. Don't lose patience. It will help you get where you want to be, and it may help us figure out how to do better with this aspect of Racket, which is by far its most innovative part and unrivaled in the world of PLs. On Jan 18, 2013, at 12:36 PM, Tim Brown wrote: >

Re: [racket] variables within macros

2013-01-19 Thread Greg Hendershott
cheme system to a very few >> primitives and build the rest around it using syntactic extensions. That may >> still be true in Racket, but dealing with the syntactic extensions >> themselves requires learning a complete new and several times more complexe >> language. Bummer.

Re: [racket] variables within macros

2013-01-19 Thread Laurent
s so obfuscated. > > > - Original Message - From: "Tim Brown" > To: "Matthias Felleisen" > Cc: "Racket Users" > Sent: Friday, January 18, 2013 6:36 PM > Subject: Re: [racket] variables within macros > > > > On 18/01/13 15:54, Ma

Re: [racket] variables within macros

2013-01-18 Thread Rüdiger Asche
t when all the beauty is so obfuscated. - Original Message - From: "Tim Brown" To: "Matthias Felleisen" Cc: "Racket Users" Sent: Friday, January 18, 2013 6:36 PM Subject: Re: [racket] variables within macros On 18/01/13 15:54, Matthias Felleisen wrote:

Re: [racket] variables within macros

2013-01-18 Thread Tim Brown
On 18/01/13 15:54, Matthias Felleisen wrote: Is there a single stumbling block or do you feel overwhelmed by the broad API to the syntax system? -- Matthias It's a combination of the two... My single stumbling block is "binding" identifiers -- I'm never sure if I'm going to end up with an iden

Re: [racket] variables within macros

2013-01-18 Thread Matthias Felleisen
Is there a single stumbling block or do you feel overwhelmed by the broad API to the syntax system? -- Matthias On Jan 18, 2013, at 6:38 AM, Tim Brown wrote: > On 17/01/13 21:33, Greg Hendershott wrote: Greg Hendershott's pages may be of interest to you: http://www.greghendershott

Re: [racket] variables within macros

2013-01-18 Thread Tim Brown
On 17/01/13 21:33, Greg Hendershott wrote: Greg Hendershott's pages may be of interest to you: http://www.greghendershott.com/fear-of-macros/ Which is as close as I have come to "How to Design Macros" so far. I read that earlier, and it gave me the confidence to get stuck in... maybe I read i

Re: [racket] variables within macros

2013-01-17 Thread Greg Hendershott
>> Greg Hendershott's pages may be of interest to you: >> http://www.greghendershott.com/fear-of-macros/ > > > I read that earlier, and it gave me the confidence to get stuck in... > maybe I read it again to give me the insight to know what I'm doing. Well it might help prepare you to understand s

Re: [racket] variables within macros

2013-01-17 Thread Tim Brown
On 17/01/13 13:40, Laurent wrote: Greg Hendershott's pages may be of interest to you: http://www.greghendershott.com/fear-of-macros/ I read that earlier, and it gave me the confidence to get stuck in... maybe I read it again to give me the insight to know what I'm doing. And I think you can f

Re: [racket] variables within macros

2013-01-17 Thread Laurent
Greg Hendershott's pages may be of interest to you: http://www.greghendershott.com/fear-of-macros/ And I think you can find some worthwhile notes on the PLT blog too. Laurent On Thu, Jan 17, 2013 at 11:08 AM, Tim Brown wrote: > Danny, Jens Axel, Ian, Ray, > > Thanks for your input... I'm absor

Re: [racket] variables within macros

2013-01-17 Thread Tim Brown
Danny, Jens Axel, Ian, Ray, Thanks for your input... I'm absorbing it all. I need some really basic help getting my head around all of this. Where can I download a copy of "How to Design Macros"? :-) Tim On 16/01/13 17:22, Jens Axel Søgaard wrote: Hi Tim, Danny explains the problem well. To

Re: [racket] variables within macros

2013-01-16 Thread Jens Axel Søgaard
Hi Tim, Danny explains the problem well. To accumulate a result, one must stay in the same same dynamic extent. One way to solve the problem is to use local-expand. In some cases one can write expanders for the forms, that needs analysing and call them directlye (rather than write a macro for the

Re: [racket] variables within macros

2013-01-16 Thread Ray Racine
Oh yea, An example of use: Define a layout of field types and lengths, then when creating a text line parser you give it the fields you want, and you get a (: Orderline-parser (String -> Orderline)) where Orderline is an implicitly created struct: (define-fixed-layout Orderline-layout (order C

Re: [racket] variables within macros

2013-01-16 Thread Ray Racine
On the topic of "state" propagation across macros by extending the expansion environment (or whatever the terminology would be).I have an example where a macro is used to define a layout of a fixed offset text file. Then a second macro expands into a mini field parser based on the layout defin

Re: [racket] variables within macros

2013-01-16 Thread Danny Yoo
On Wed, Jan 16, 2013 at 7:24 AM, Tim Brown wrote: > Folks, > > I would like to write a module that uses a macro to transform "define"s > and accumulate a value based on those transformations. > > In a fairly simple way, I want to do something like the below. However, it > seems the module-begin is

Re: [racket] variables within macros

2013-01-16 Thread J. Ian Johnson
tself. You could also just do a local-expand for the effect on counter to get your result, but I don't recommend this. -Ian - Original Message - From: "Tim Brown" To: "Racket Users" Sent: Wednesday, January 16, 2013 9:24:44 AM GMT -05:00 US/Canada Eastern Subj

[racket] variables within macros

2013-01-16 Thread Tim Brown
Folks, I would like to write a module that uses a macro to transform "define"s and accumulate a value based on those transformations. In a fairly simple way, I want to do something like the below. However, it seems the module-begin is being transformed before the my-defines. How do I get counter