[racket] Sweet expressions; or making it easier to introduce Racket to me and my coworkers :-)

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Tue Jul 26 17:39:05 EDT 2011

+1!

-- Éric


On Jul 26, 2011, at 9:30 PM, Casey Klein wrote:

> On Mon, Jul 25, 2011 at 11:20 PM, David Van Horn <dvanhorn at ccs.neu.edu> wrote:
>> 
>> Cute!  Thanks for the cool planet package.  Here's a slightly larger example
>> using Redex, adapted from redex/examples/arithmetic.rkt:
>> 
>> #lang planet asumu/sweet racket
>> require rename-in(redex [term quote])
>> 
>> define-language lang
>>  e n
>>    δ1(e)
>>    δ2(e e)
>>  δ1 √ add1 sub1
>>  δ2 + - * /
>>  E hole
>>    δ1(E)
>>    δ2(e E)
>>    δ2(E e)
>>  n number
>> 
>> define v
>>  reduction-relation lang
>>    { √(n) --> ,sqrt('n) }
>>    { add1(n) --> ,add1('n) }
>>    { sub1(n) --> ,sub1('n) }
>>    { +(n_1 n_2) --> ,+('n_1 'n_2) }
>>    { -(n_1 n_2) --> ,-('n_1 'n_2) }
>>    { *(n_1 n_2) --> ,*('n_1 'n_2) }
>>    { /(n_1 n_2) --> ,/('n_1 'n_2) }
>> 
>> define -->_v
>>  context-closure v lang E
>> 
>> traces -->_v '-(*(√(36) /(1 2)) +(1 2))
>> 
> 
> If only Redex could typeset in this syntax :)
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users




Posted on the users mailing list.