[racket] `def' ?

From: Ray Racine (ray.racine at gmail.com)
Date: Thu May 10 18:13:40 EDT 2012

Give '{' yada '}' definable language semantics in the sense of #lang yada.

Similar to SML-NJ Quote/Antiquote but leveraging Rackets more robust
built-in language support.

So a source file could be.

==========
#lang racket
#lang {{ formula }}

(define x 3)
(define y 2)

(define z {{ log (x + y) }})

#lang {{ datalog }} ;; switch datalog language

(define result {{
  ancestor(A, B) :- parent(A, B).  ancestor(A, B) :-  parent(A, C), D = C,
ancestor(D, B).  parent(john, douglas).  parent(bob, john).  ancestor(A, B)?
}} )

#lang {{ formula }} ;; back to math formula

(define ans (some-procedure result {{ z^2 + 42 }}))
=======

just works.









On Thu, May 10, 2012 at 4:44 PM, John Clements <clements at brinckerhoff.org>wrote:

>
> On May 10, 2012, at 1:00 PM, Matthias Felleisen wrote:
>
> >
> > I will assert something about readability:
> >
> > Racket programs look heavy when compared with Haskell programs.
> >
> > This is probably true for Python instead of Haskell, too. It is also
> true for ML. I conjecture that part of that heaviness comes from wide
> lines, long names, deep nesting. Who knows. I don't even know how to
> measure this kind of property.
> >
> > At this point, I can express certain ideas more easily in Racket than in
> Haskell, Python, ML or whatever, which is why I am fine. But if this
> advantage ever disappeared, heaviness would definitely be a factor to weigh.
>
> +1
>
> John
>
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120510/5260c145/attachment-0001.html>

Posted on the users mailing list.