[racket] Compile-time evaluation

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Mon Jul 29 22:07:40 EDT 2013

Yes. Really it is read-time.

In CL every top level expression read-compile-load or simply load if it is compiled. 

So in Racket would be natural to have (for-syntax ...) environment in #. I hope, that Racket also read toplevel form, loads it, then reads next (not reads all at once, then load first form , second form and so on).

Can you invent such read-macro?


Понедельник, 29 июля 2013, 21:44 -04:00 от Sam Tobin-Hochstadt <samth at ccs.neu.edu>:
>On Mon, Jul 29, 2013 at 1:53 PM, Vincent St-Amour < stamourv at ccs.neu.edu > wrote:
>> Here's a quick solution:
>>
>> #lang racket
>>
>> (define-syntax-rule (hash-dot e)
>> (let-syntax ([computed-e (lambda (stx) (datum->syntax #'e e))])
>> (computed-e)))
>>
>> (hash-dot (+ 2 3))
>>
>
>In CL, #. is read-time, not compile-time, evaluation, so this isn't
>quite the same. It would be easy to create a read-table that enabled
>this, though. You'd have to make some decision about what environment
>the read-time expression sees -- I don't know what CL does here.
>
>Sam


-- 
Roman Klochkov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130730/38718300/attachment.html>

Posted on the users mailing list.