[plt-scheme] [redex] language keywords

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Thu Jun 3 10:22:46 EDT 2010

Looking at the Redex book, I guess the answer to my question is "yes".

So, it may be a good idea to update the redex website accordingly.

Thanks,

-- Éric


On Jun 3, 2010, at 10:09 AM, Eric Tanter wrote:

> Is this 'where' clause something that was introduced somewhat recently?
> I remember from my first redex examples that the way to introduce a new identifier for instance was with ,(term-let ...).
> 
> The same question goes for the definition of metafunctions. For instance, the definition of lambda-v on the web:
> http://redex.plt-scheme.org/lam-v.html
> for the subst metafunction, uses ,(term-let ...) to introduce (x_new ...) 
> 
> It seems the preferred way to do that now would be with a where clause, right?
> 
> (I was surprised actually when seeing in the doc that term-let was low-level and not meant to use, while it was--and still is in some cases-- used in the simple introductory examples of plt redex)
> 
> Thanks,
> 
> -- Éric
> 
> 
> On Jun 3, 2010, at 9:15 AM, Robby Findler wrote:
> 
>> Oh, great!
>> 
>> Robby
>> 
>> On Thu, Jun 3, 2010 at 8:12 AM, Eric Tanter <etanter at dcc.uchile.cl> wrote:
>>> Thanks all,
>>> 
>>> I'm moving to 'where' everywhere, and it seems to work. It's even much more readable with where clauses than with the collections of (nested) term-lets that I had.
>>> 
>>> -- Éric
>>> 
>>> 
>>> On Jun 3, 2010, at 2:36 AM, Robby Findler wrote:
>>> 
>>>> It would be good to avoid term-let, I think, if you can use things
>>>> like 'where' in the reduction relation instead. But we'd probably need
>>>> to see an example use if you don't see how to do the transformation.
>>>> 
>>>> Robby
>>>> 
>>>> On Wed, Jun 2, 2010 at 9:51 PM, Eric Tanter <etanter at dcc.uchile.cl> wrote:
>>>>> Yes, I do use term-let and that's (at least up to now) exactly where the
>>>>> problem manifests!
>>>>> 
>>>>> Should I be using something else?
>>>>> 
>>>>> -- Éric
>>>>> 
>>>>> On Jun 2, 2010, at 22:40, Casey Klein <clklein at eecs.northwestern.edu> wrote:
>>>>> 
>>>>>> On Wed, Jun 2, 2010 at 9:21 PM, Carl Eastlund <cce at ccs.neu.edu> wrote:
>>>>>>> 
>>>>>>> On Wed, Jun 2, 2010 at 10:15 PM, Casey Klein
>>>>>>> <clklein at eecs.northwestern.edu> wrote:
>>>>>>>> 
>>>>>>>> On Wed, Jun 2, 2010 at 9:02 PM, Eric Tanter <etanter at dcc.uchile.cl>
>>>>>>>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>> Is there something as simple/direct as the list of keywords in
>>>>>>>>>>> syntax-rules/syntax-case?
>>>>>>>>>>> If not, any alternative suggestion?
>>>>>>>>>>> 
>>>>>>>>>>> Thanks!
>>>>>>>>>>> 
>>>>>>>>>>> -- Éric
>>>>>>>>>> 
>>>>>>>>>> Take a look at variable-prefix.  In my latest Redex work, variables
>>>>>>>>>> all start with x, y, or z, and I just have to avoid any keywords that
>>>>>>>>>> start with those.
>>>>>>>>> 
>>>>>>>>> Thanks Carl,
>>>>>>>>> 
>>>>>>>>> I'm using these as well, actually.
>>>>>>>>> A problem I have is that, for readability, I have a non-terminal which
>>>>>>>>> is define as (x >> x) where '>>' is a keyword. I know I could just use (x x)
>>>>>>>>> for exactly the same, but it does enhance readability.
>>>>>>>>> The problem is that >> is considered as a pattern variable...
>>>>>>>>> 
>>>>>>>>> with macros I could just say:
>>>>>>>>> (syntax-rules (>>)
>>>>>>>>> ((x >> x) ...))
>>>>>>>>> 
>>>>>>>>> Any idea?
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> I don't follow. The variables in a Redex pattern are always named
>>>>>>>> after non-terminals, so I don't see how >> could be treated as a
>>>>>>>> pattern variable.
>>>>>>>> 
>>>>>>>> Do you mean that >> matches one of your six classes of variables?
>>>>>>> 
>>>>>>> Is it possible Eric is using one of the forms that match using
>>>>>>> syntax-case instead of the Redex pattern matcher?  Do term-let and
>>>>>>> where clauses still work that way?
>>>>>> 
>>>>>> Oh, good thinking! term-let uses syntax-case, but where clauses no longer
>>>>>> do.
>>>>>> 
>>>>>>> (And if not, Eric, what version of PLT Scheme are you using?)
>>>>>>> 
>>>>> _________________________________________________
>>>>> For list-related administrative tasks:
>>>>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>> 
>>> 
>>> 
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.