Re: [racket-dev] Racket peephole opt in lieu of TR's generalized ListDots to usefully type hash
How about `(hash-set #hash() k v)`? (I probably should have been more careful in defining `hash` to allow it to return a constant when given 0 arguments.) At Sat, 28 Jun 2014 09:56:05 -0400 (EDT), "J. Ian Johnson" wrote: > I depend highly on creating singleton hashes in my program (one key maps). I > tried a few ways to create them, but alas directly using hash is the best. TR > can't type non-nullary applications hash though. > The times of the following test are the same in TR as in normal Racket, so > I'd > like to see peephole optimizations that turn the first two into the last one: > > #lang racket > > (define N 500) > (define keys (build-list N (λ (d) (random > (define values (build-list N (λ (d) (random > > (define (clean!) > (collect-garbage) > (collect-garbage) > (collect-garbage)) > (clean!) > (time (for ([k (in-list keys)] > [v (in-list values)]) > (hash-set (hash) k v))) > ;cpu time: 460 real time: 461 gc time: 13 > > (clean!) > (time (for ([k (in-list keys)] > [v (in-list values)]) > (make-immutable-hash (list (cons k v) > ;cpu time: 507 real time: 506 gc time: 29 > > (clean!) > (time (for ([k (in-list keys)] > [v (in-list values)]) > (hash k v))) > ;cpu time: 393 real time: 392 gc time: 17 > > ;;; > > I'd provide a patch, but I don't know where this kind of thing lives in the > compiler if it exists at all. > -Ian > > _ > Racket Developers list: > http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] 2htdp/image Feature Suggestion
On Mon, Jun 23, 2014 at 9:44 PM, Jos Koot wrote: > style. Writing this, the idea comes up in my mind that it should be possible > to do some transformations to the recommended style by means of redex. Or > may be by means of syntax-case while limiting the transformers to the > desired level of expansion. Both instuments are interesting enough for me to > give it a try. If I am able to do something usefull in this sense, you'll > hear of me, but give me some time, please. If you use Emacs, check out Ryan's sexp-rewrite mode. IIUC he's implemented `syntax-parse`-like functionality in Elisp: https://github.com/rmculpepper/sexp-rewrite p.s. In a similar spirit, but for Clojure, and IIUC implemented leveraging paredit: https://github.com/clojure-emacs/clj-refactor.el _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] [plt] Push #28945: master branch updated
I'd like to see screenshots of the pdfs in whatever viewer you usually use, if you don't mind. Also: what latex distribution are you using? Robby On Sat, Jun 28, 2014 at 12:16 PM, Sam Tobin-Hochstadt wrote: > Attached is a screenshot from the diffpdf tool. You can see that the > font rendering is different in a few places. > > You can also see that --dvipdf loses the rest of the document after > the Redex pict -- I don't know what could cause that. > > Basically the same things happen on my other linux machine. > > Sam > > On Fri, Jun 27, 2014 at 9:18 PM, Robby Findler > wrote: >> PS: Sam, were you able to produce two pdfs (via scribble --dvipdf and >> --pdf) and compare their output on your machine? Do you have >> screenshots to share? >> >> Robby _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] Racket peephole opt in lieu of TR's generalized ListDots to usefully type hash
I depend highly on creating singleton hashes in my program (one key maps). I tried a few ways to create them, but alas directly using hash is the best. TR can't type non-nullary applications hash though. The times of the following test are the same in TR as in normal Racket, so I'd like to see peephole optimizations that turn the first two into the last one: #lang racket (define N 500) (define keys (build-list N (λ (d) (random (define values (build-list N (λ (d) (random (define (clean!) (collect-garbage) (collect-garbage) (collect-garbage)) (clean!) (time (for ([k (in-list keys)] [v (in-list values)]) (hash-set (hash) k v))) ;cpu time: 460 real time: 461 gc time: 13 (clean!) (time (for ([k (in-list keys)] [v (in-list values)]) (make-immutable-hash (list (cons k v) ;cpu time: 507 real time: 506 gc time: 29 (clean!) (time (for ([k (in-list keys)] [v (in-list values)]) (hash k v))) ;cpu time: 393 real time: 392 gc time: 17 ;;; I'd provide a patch, but I don't know where this kind of thing lives in the compiler if it exists at all. -Ian _ Racket Developers list: http://lists.racket-lang.org/dev