Re: [racket-dev] for loop singleton optimization

2012-11-29 Thread Tobias Hammer
- Original Message - From: Matthew Flatt mfl...@cs.utah.edu To: J. Ian Johnson i...@ccs.neu.edu Cc: dev dev@racket-lang.org Sent: Wednesday, November 28, 2012 12:58:09 PM GMT -05:00 US/Canada Eastern Subject: Re: [racket-dev] for loop singleton optimization I think that would be an ad hoc

Re: [racket-dev] for loop singleton optimization

2012-11-29 Thread Matthew Flatt
an improvement. Thanks, -Ian - Original Message - From: Matthew Flatt mfl...@cs.utah.edu To: J. Ian Johnson i...@ccs.neu.edu Cc: dev dev@racket-lang.org Sent: Wednesday, November 28, 2012 12:58:09 PM GMT -05:00 US/Canada Eastern Subject: Re: [racket-dev] for loop singleton

Re: [racket-dev] for loop singleton optimization

2012-11-29 Thread J. Ian Johnson
Eastern Subject: Re: [racket-dev] for loop singleton optimization What about (let ([set (lambda (a) (set 1 2 a))]) (for/list ([x (in-set (set 3))]) x)) ? Tobias On Wed, 28 Nov 2012 19:24:12 +0100, J. Ian Johnson i...@ccs.neu.edu wrote: Cool. I submitted a pull request

[racket-dev] for loop singleton optimization

2012-11-28 Thread J. Ian Johnson
It would be great to optimize singletons out of comprehensions, since I (and probably others) have macros that expand into singleton constructors that are much better suited to just be a rebinding. (time (for ([n (in-range 1 100)]) (for ([k (in-set (set n))]) (random k cpu time: 340

Re: [racket-dev] for loop singleton optimization

2012-11-28 Thread Matthew Flatt
I think that would be an ad hoc optimization in each `in-'. For example, (define-sequence-syntax *in-set (lambda () #'in-set) (lambda (stx) (syntax-case stx () [[(id) (_ st)] in `racket/set' could change to (define-sequence-syntax *in-set (lambda () #'in-set)

Re: [racket-dev] for loop singleton optimization

2012-11-28 Thread J. Ian Johnson
Eastern Subject: Re: [racket-dev] for loop singleton optimization I think that would be an ad hoc optimization in each `in-'. For example, (define-sequence-syntax *in-set (lambda () #'in-set) (lambda (stx) (syntax-case stx () [[(id) (_ st)] in `racket/set' could change