[racket] How to view source code of procedures? MIT scheme "pp" equivalent?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Dec 29 20:37:57 EST 2013

That's precisely what (2) was getting at. Good luck and SOS as much as you need -- Matthias



On Dec 29, 2013, at 6:23 PM, Scott Klarenbach wrote:

> I think I have a much simpler approach for my purposes.  I can have a (define-expression ...) macro that basically just stores the expression as a quoted list.  This largely emulates c#'s expression trees, but with a lot less hassle and ugly syntax.  I can then achieve the composition I desire through quasiquoting/unquoting the expressions.  ie,
> 
> `(lambda (x) (and (> x 3) ,(some-other-expression x)))
> 
> I can then inspect the expression and translate it accordingly for various source data (sql, xpath, files, vectors), etc.
> 
> A reread of http://homepages.inf.ed.ac.uk/slindley/papers/practical-theory-of-linq.pdf shows that basically all they are doing is quoting and unquoting expressions and then normalizing them for a particular runtime target.  Through this you can achieve a lot of the composition and parametrization of queries that is sorely lacking in sql.
> 
> I'll keep you posted, most likely via random SOS pings to this list :).
> 
> Thanks.
> 
> 
> On Sun, Dec 29, 2013 at 10:16 AM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
> 
> On Dec 28, 2013, at 2:01 PM, Scott Klarenbach wrote:
> 
>> I'm playing around with the idea of a sort of "Language Integrated Query" like LINQ.  For example:
>> 
>> > (sql (query 'my-table
>>      #:where (λ (row) (> (hash-ref row 'id) 3))))
>> "select * from my-table where id > 3"
>> 
> 
> I understand your motivation now. See Greg's suggestions. I think they are right on. 
> 
>> In another thread, I'd like to poll this list as to the benefits (if any) of such a linq-style approach.  I got inspired by this paper: http://homepages.inf.ed.ac.uk/slindley/papers/practical-theory-of-linq.pdf and really enjoyed the c# linq stuff I've played around with.  It may very well be; however, that this is not desired or useful,
> 
> 
> (1) Part of the Racket philosophy is not to exclude some approach because it is not desired or not considered useful. We welcome experimentations such as yours and when things fail, we re-consider our language. (No promise that we change it :-) 
> (2) I think a DSL approach to DBs based on syntactic abstractions might be more useful. 
> 
> Keep us posted. Better yet, report on your experience at the next RacketCon. 
> 
> 
> 
>> As an aside:
>>  
>> This might be a MIT misunderstanding about the relationship between Scheme and the lambda calculus. It is certainly not possible in general and I see no pragmatic use case for an approximation. 
>> 
>> It would be really nice to print the source code of a known procedure on the repl, in order to get a quick view of what it does.  Or, the "pa" function which prints out the arguments of a procedure is even more useful.
> 
> 
> I think a function that displays (1) docs and/or (2) specs (say contracts) might be a lot more useful than raw source. 
> 
> -- Matthias
> 
> 
> 
> 
> 
> 
> -- 
> Talk to you soon,
> 
> Scott Klarenbach
> 
> PointyHat Software Corp.
> www.pointyhat.ca
> p 604-568-4280
> e scott at pointyhat.ca
> 200-1575 W. Georgia
> Vancouver, BC V6G2V3
> 
> _______________________________________
> To iterate is human; to recur, divine

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

Posted on the users mailing list.