Re: [racket] generate-temporaries with source location?

2011-07-14 Thread Danny Yoo
On Fri, Jul 15, 2011 at 1:41 AM, Carl Eastlund wrote: > It's easy to add this: > > (define (generate-temporaries/locs xs) >  (for/list {[x (in-list (if (syntax? xs) (syntax->list xs) xs)]} >    (define sym (if (identifier? x) (syntax-e x) 'fresh)) >    (define src (if (syntax? x) x #f)) >    (defi

Re: [racket] generate-temporaries with source location?

2011-07-14 Thread Carl Eastlund
It's easy to add this: (define (generate-temporaries/locs xs) (for/list {[x (in-list (if (syntax? xs) (syntax->list xs) xs)]} (define sym (if (identifier? x) (syntax-e x) 'fresh)) (define src (if (syntax? x) x #f)) (define mark (make-syntax-introducer)) (mark (datum->syntax #f sy

[racket] what kind of Racket editor operations would you like to see?

2011-07-14 Thread Neil Van Dyke
What kind of Racket editor operations would you like to see? With the forthcoming Emacs mode for Racket, called Meow, I intend to provide a conventional typing interface and also some sexp-oriented operations that people can adopt incrementally if they want. ("meta-uparrow", to move up a sexp

[racket] generate-temporaries with source location?

2011-07-14 Thread Danny Yoo
I'd like the ability to generate a bunch of temporaries, but with specific source locations. I'm having an awkward time fixing an embarrassing bug in my chaining-compare library. I have the following expression: (with-syntax ([rhs-value (datum->syntax #f

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Danny Yoo
> > P.S.  I'm enjoying this discussion.  I feel like I'm finally getting a > handle on what kind of how "syntax" is represented and manipulated in > Racket.  It still seems like an awful lot of work, though, so I would > like to see more examples of why it is worth the I wrote a package the other

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Mark Engelberg
On Thu, Jul 14, 2011 at 4:35 AM, Thomas Chust wrote: > While Clojure *mitigates* the problems of non-hygienic macros using > namespaces and a shorthand syntax for freshly generated identifiers, it > doesn't *solve* the problems. Racket's macro system, on the other hand, > does solve the problems a

Re: [racket] Periodic calls to collect-garbage?

2011-07-14 Thread Greg Hendershott
> I've also seen this on a simple web crawler kind of app, accumulating > stuff in memory rather than on disk. If it hits the max, I've never > seen a seg fault, but I've gotten the cleaner abend with message. P.S. Maybe disregard that example; it has fur on it. Of course something that accumulate

Re: [racket] Periodic calls to collect-garbage?

2011-07-14 Thread Greg Hendershott
I wonder if Jay or whoever was involved with that web server code may remember something about this? Anyway I will try to make a simple-as-possible recipe for you. I'd posted on the list a few months ago about a simple mail relay "shim" I'd deployed that segfaulted. As best I could figure out, th

Re: [racket] FFI question: 0 microseconds returned from gettimeofday call

2011-07-14 Thread Thomas Chust
keyd...@gmx.de wrote: > [...] > In fact I'd assume that using _int for suseconds_t should work fine, too, > given that man even tells us that > > "The values in timeval are opaque types whose length may vary on different > machines; depending on > them to have any given length may lead to e

[racket] FFI question: 0 microseconds returned from gettimeofday call

2011-07-14 Thread keyd...@gmx.de
Hi, I am kind of stuck trying to get the current microsecond from gettimeofday... and I wonder how best to systematically approach the question of what racket datatype to choose when defining a FFI function. From the man page I see that timeval is defined as struct timeval { time_

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Matthias Felleisen
On Jul 14, 2011, at 3:32 PM, Eli Barzilay wrote: > (let ([tmp 4]) (or #f tmp)) --should-be-> 4 > > This side is easy to fix using gensyms. Except that even old Lisp guys forget, get it wrong, whatever. Nothing's easy ;-) _ For list-related a

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
15 minutes ago, Markku Rontu wrote: > On Thu, Jul 14, 2011 at 9:58 PM, Eli Barzilay wrote: > > (define-syntax (rapp stx) > >(syntax-case stx () > > [(rapp f x ...) #`(f #,@(reverse (syntax->list #'(x ...])) > > [...] > > > I would not call this piece of code much more obvious, it ha

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
30 minutes ago, Markku Rontu wrote: > Well one problem is that all these syntax objects have introduced a > new language, with accessors and functions that are completely new > that must be learnt. And programs using these new functions look > quite different to standard data structure (i.e., cons

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
25 minutes ago, Markku Rontu wrote: > > Sure, if you take the TM-equivalent path then nothing is broken, of > > course... (That path tends to melt away all of PL into a weak *puff* > > of irrelevance...) > > > I mean exactly this sense of disingenuousness when you use the word > broken for somethi

Re: [racket] Periodic calls to collect-garbage?

2011-07-14 Thread Matthew Flatt
This sounds like a bug. Explicit calls to `collect-garbage' shouldn't be needed for the garage collector to do its job. Does anyone know an easy way for me to make the problem happen, so I can see what is going on? At Thu, 14 Jul 2011 12:47:54 -0400, Greg Hendershott wrote: > Once upon a time I n

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
On Thu, Jul 14, 2011 at 9:58 PM, Eli Barzilay wrote: > 25 minutes ago, Markku Rontu wrote: > > > > > http://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt > > [...] > > > > Still, I count it as good eye opening material :) > > Well, it has a heavy focus on "computations via rew

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
On Thu, Jul 14, 2011 at 10:03 PM, Eli Barzilay wrote: > 10 minutes ago, Markku Rontu wrote: > > On Thu, Jul 14, 2011 at 6:23 PM, Eli Barzilay wrote: > > > No, it's broken in pretty much all cases. Give me a single > > > symbolic macro and I'll show you how it's broken. (And point out > > > how

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
10 minutes ago, Markku Rontu wrote: > On Thu, Jul 14, 2011 at 6:23 PM, Eli Barzilay wrote: > > No, it's broken in pretty much all cases. Give me a single > > symbolic macro and I'll show you how it's broken. (And point out > > how CL bypasses the problem...) > > > I think it's a bit disingenuous

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
Hey Thomas, On Thu, Jul 14, 2011 at 8:21 PM, Thomas Chust wrote: > Markku Rontu wrote: > > [...] > > I'm sure the section 11 does go through the relevant issues, but doesn't > > feel like a good introduction to the matter. I can theorise that I can > > manipulate these syntax objects with plain

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
25 minutes ago, Markku Rontu wrote: > > > http://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt > [...] > > Still, I count it as good eye opening material :) Well, it has a heavy focus on "computations via rewriting", which can of course be an eye opener, but off-topic when tal

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
Hi again, On Thu, Jul 14, 2011 at 6:23 PM, Eli Barzilay wrote: > Two hours ago, Markku Rontu wrote: > > > this is not really true. The domain specific languages of > > > syntax-rules and syntax-case macro transformers exist purely for > > > your convenience. You can always manipulate syntax obj

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
Hi Eli, On Thu, Jul 14, 2011 at 6:04 PM, Eli Barzilay wrote: > Commet for the short-attention-spanners: read this: > > http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html > > Thanks for writing this. It is so far the best introduction to this matter I've seen. > 5 hours ago, M

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
Hi Matthias, On Thu, Jul 14, 2011 at 6:00 PM, Matthias Felleisen wrote: > > You may wish to read this write-up on the Racket blog: > > http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html > > Thanks, I had previously browsed through it. It's so far the best introductory material t

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Thomas Chust
Markku Rontu wrote: > [...] > I'm sure the section 11 does go through the relevant issues, but doesn't > feel like a good introduction to the matter. I can theorise that I can > manipulate these syntax objects with plain old functions but nowhere > does it seem to show a complete useful case. What

[racket] Periodic calls to collect-garbage?

2011-07-14 Thread Greg Hendershott
Once upon a time I noticed the Racket web server has a thread that calls collect-garbage periodically (e.g. every 5 minutes). I've discovered I need to do the same, for any program that needs to run for hours or days. Otherwise, the program eventually abends: Out of memory. Sometimes with a "Rack

Re: [racket] Continue: reentrant promises and custodian suicides

2011-07-14 Thread Ryan Culpepper
On 07/14/2011 09:30 AM, Eli Barzilay wrote: 10 minutes ago, Ryan Culpepper wrote: On 07/14/2011 08:31 AM, Dominic Pearson wrote: Hello folks! I have been writing an application in Racket using Continue, and have been stress testing it in the early development phase using `siege', to see if it

Re: [racket] Continue: reentrant promises and custodian suicides

2011-07-14 Thread Dominic Pearson
Hi Ryan, On Thu, Jul 14, 2011 at 09:17:39AM -0600, Ryan Culpepper wrote: > > force: reentrant promise fun-p > > Those look like they're from ryanc/db. I suspect you see them at the > very beginning, before the "lazy requires" (which are implemented > with promises) have been forced. Thanks

Re: [racket] Emacs, racket and OS X issues

2011-07-14 Thread Eli Barzilay
Two minutes ago, Francis Lavoie wrote: > I use racket with M-x run-scheme not slime. In that case, the full path would look like: (setq scheme-program-name "/wherever/you/have/racket") > compiling is definetly overkill, but I'm not sure the parameters are > incompatible. There's a lot of app

Re: [racket] Emacs, racket and OS X issues

2011-07-14 Thread Francis Lavoie
# sorry, I didn't reply to the list gnu emacs, Aquamacs has the same behavior. As John writes, launching emacs from terminal set the PATH correctly. 2011/7/14 Noel Welsh > Are you using Aquamacs? > > N. > > On Thu, Jul 14, 2011 at 4:19 AM, Lavoie Francis > wrote: > > First, it looks like ema

Re: [racket] Emacs, racket and OS X issues

2011-07-14 Thread Francis Lavoie
# sorry, I didn't reply to the list I use racket with M-x run-scheme not slime. compiling is definetly overkill, but I'm not sure the parameters are incompatible. There's a lot of application on OS X that uses the same structure as on unix/linux. 2011/7/14 Eli Barzilay > 9 hours ago, John Cl

Re: [racket] Emacs, racket and OS X issues

2011-07-14 Thread Francis Lavoie
# sorry, I didn't reply to the list Starting emacs from shell does work. I installed quack, it looks like it manage scheme command. There's probably a way to customize it. ./configure --enable-mac64 : for snow leopard in 64 bit --enable-xonx : to make a unix like installation (need for --prefix)

Re: [racket] Continue: reentrant promises and custodian suicides

2011-07-14 Thread Eli Barzilay
10 minutes ago, Ryan Culpepper wrote: > On 07/14/2011 08:31 AM, Dominic Pearson wrote: > > Hello folks! > > > > I have been writing an application in Racket using Continue, and have > > been stress testing it in the early development phase using `siege', to > > see if it is suitable for future heav

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Matthias Felleisen
On Jul 14, 2011, at 11:23 AM, Eli Barzilay wrote: >> >> It's simple, it's been explained countless times, it works in many >> cases. > > No, it's broken in pretty much all cases. Give me a single symbolic > macro and I'll show you how it's broken. (And point out how CL > bypasses the problem.

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
Two hours ago, Markku Rontu wrote: > > this is not really true. The domain specific languages of > > syntax-rules and syntax-case macro transformers exist purely for > > your convenience. You can always manipulate syntax objects > > directly, all the necessary procedures are available and > > docu

Re: [racket] Continue: reentrant promises and custodian suicides

2011-07-14 Thread Ryan Culpepper
On 07/14/2011 08:31 AM, Dominic Pearson wrote: Hello folks! I have been writing an application in Racket using Continue, and have been stress testing it in the early development phase using `siege', to see if it is suitable for future heavy lifting. Under high load I get some very odd messages.

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Eli Barzilay
Commet for the short-attention-spanners: read this: http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html 5 hours ago, Markku Rontu wrote: > This tutorial helped me to understand some basics of macros. For > example how to generate code with them. Now Racket has lots of other > f

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Matthias Felleisen
You may wish to read this write-up on the Racket blog: http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html On Jul 14, 2011, at 8:58 AM, Markku Rontu wrote: > Hi Thomas, > > Thanks, this is a very interesting topic to me, and I'm glad someone "did > bite" :) > > On Thu, J

Re: [racket] Emacs, racket and OS X issues

2011-07-14 Thread Eli Barzilay
9 hours ago, John Clements wrote: > On Jul 13, 2011, at 8:19 PM, Lavoie Francis wrote: > > I want to learn racket. I already started learning lisp from Land > > of Lisp, Practical Common Lisp and a bit of Clojure. > > > > For my everyday job (python, javascript) I use emacs, to learn > > lisp and

[racket] Continue: reentrant promises and custodian suicides

2011-07-14 Thread Dominic Pearson
Hello folks! I have been writing an application in Racket using Continue, and have been stress testing it in the early development phase using `siege', to see if it is suitable for future heavy lifting. Under high load I get some very odd messages. Requests sometimes fail with force: ree

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Maurizio Giordano
On Thu, 2011-07-14 at 08:53 -0400, Stephen Bloch wrote: > On Jul 14, 2011, at 7:56 AM, Maurizio Giordano wrote: > > > About optimization... in my case the main optimization is: > > 1) My macro has to generate a function which has to perform some > > recursive tasks > > (for example, it has to do

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
Hi Thomas, Thanks, this is a very interesting topic to me, and I'm glad someone "did bite" :) On Thu, Jul 14, 2011 at 2:35 PM, Thomas Chust wrote: > Markku Rontu wrote: > > [...] > > On the topic of macros, I find it a bit confusing that to metaprogram in > > Racket, I must use such a different

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Stephen Bloch
On Jul 14, 2011, at 7:56 AM, Maurizio Giordano wrote: > About optimization... in my case the main optimization is: > 1) My macro has to generate a function which has to perform some > recursive tasks > (for example, it has to do a recursive pattern matching on a set of > elements) > 2) Instead of

Re: [racket] users Digest, Vol 71, Issue 37

2011-07-14 Thread Max Polk
> On Thu, Jul 14, 2011 at 4:19 AM, Lavoie Francis wrote: >> First, it looks like emacs for OS X does not use the users' own $PATH, but >> the one of the system. I tried some hack I found on google >> (http://olabini.com/blog/2009/12/path-problem-with-emacs-on-mac-os-x/, >> http://www.emacswiki

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Maurizio Giordano
Hi Markku, On Thu, 2011-07-14 at 13:22 +0300, Markku Rontu wrote: > Hi Maurizio, > > I guess what you are trying to do is possible with macros, but I could > be wrong as it is difficult to understand what you are doing, because > we all seem to lack a common vocabulary in this matter. Sorry if I

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Matthias Felleisen
This is an excellent explanation. Thanks. I'd like to add a little-understood that Lisp-style macros as found in Common Lisp and Clojure are LESS expressive than Racket macros. In essence, Racket (and Scheme) chose to use a data structure called SYNTAX instead of S-EXPRESSION but one can argu

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Thomas Chust
Markku Rontu wrote: > [...] > On the topic of macros, I find it a bit confusing that to metaprogram in > Racket, I must use such a different language of macros (with > syntax-rules et al.), instead of being able to manipulate common data > structures with plain old Racket functions. > [...] Hello,

Re: [racket] How to verify prime numbers.

2011-07-14 Thread Stephen Bloch
On Jul 14, 2011, at 1:56 AM, 飞刀 wrote: > Hello everyone, > > I want a program to verify prime numbers which can be runned in mzscheme. > The following is C source. I don't konwn how to convert it to lisp. Well, I wouldn't start from that C code, as the idiomatic way to solve a problem in C

Re: [racket] Again on bindings visibility in eval

2011-07-14 Thread Markku Rontu
Hi Maurizio, I guess what you are trying to do is possible with macros, but I could be wrong as it is difficult to understand what you are doing, because we all seem to lack a common vocabulary in this matter. Sorry if I misunderstood your intentions. Your expander seems to be a function. I think

Re: [racket] Emacs, racket and OS X issues

2011-07-14 Thread Noel Welsh
Are you using Aquamacs? N. On Thu, Jul 14, 2011 at 4:19 AM, Lavoie Francis wrote: > First, it looks like emacs for OS X does not use the users' own $PATH, but > the one of the system. I tried some hack I found on google > (http://olabini.com/blog/2009/12/path-problem-with-emacs-on-mac-os-x/,