Re: [racket-dev] [racket-bug] all/13315: TR error messages from raco setup unhelpful
Thanks Asumu for making those fixes! Asumu Takikawa as...@ccs.neu.edu writes: On 5.3.1, you'll have to add extra type instantiations in the tests or just remove the test files. I was also e-mailing Sam about this, so some wires got crossed: Sam, Asumu's fixes make the build go through now. Sam also asked about the REPL output: (queue 1 2 3) - : (Queue Any) #Queue I gather that in earlier versions of Racket, I'd get (Queue Positive-Byte) or something similar. Is (ann (queue 1 2 3) (Queue Integer)) the right fix for this? It seems awfully awkward. -- Regards, Mike _ Racket Developers list: http://lists.racket-lang.org/dev
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 with this change since it's always 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 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 to (define-sequence-syntax *in-set (lambda () #'in-set) (lambda (stx) (syntax-case stx (set) [[(id) (_ (set v))] #`[(id) (in-value v)]] [[(id) (_ st)] At Wed, 28 Nov 2012 12:50:49 -0500 (EST), J. Ian Johnson wrote: 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 real time: 338 gc time: 16 (time (for ([n (in-range 1 100)]) (for ([k (in-value n)]) (random k cpu time: 120 real time: 118 gc time: 0 Is this easily added to for.rkt? -Ian _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev -- - Tobias Hammer DLR / Institute of Robotics and Mechatronics Muenchner Str. 20, D-82234 Wessling Tel.: 08153/28-1487 Mail: tobias.ham...@dlr.de _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] Missing spel cheker
Hi, in the release notes of 5.3.1, there's: • DrRacket can spell-check string constants (enable this in the Edit menu). I can't find anything related in the Edit menu, and searching for spell in the help desk turns out empty. (On Windows, in case it matters). Cheers P. _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] for loop singleton optimization
That works fine (i.e., does not get changed to `in-value'). Matching `set' as a literal in `syntax-case' works by identifier binding, not symbolically. If `set' has a different binding than the one exported by the module, then the optimizing case doesn't match. At Thu, 29 Nov 2012 10:49:15 +0100, Tobias Hammer wrote: 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 with this change since it's always 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 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 to (define-sequence-syntax *in-set (lambda () #'in-set) (lambda (stx) (syntax-case stx (set) [[(id) (_ (set v))] #`[(id) (in-value v)]] [[(id) (_ st)] At Wed, 28 Nov 2012 12:50:49 -0500 (EST), J. Ian Johnson wrote: 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 real time: 338 gc time: 16 (time (for ([n (in-range 1 100)]) (for ([k (in-value n)]) (random k cpu time: 120 real time: 118 gc time: 0 Is this easily added to for.rkt? -Ian _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev -- - Tobias Hammer DLR / Institute of Robotics and Mechatronics Muenchner Str. 20, D-82234 Wessling Tel.: 08153/28-1487 Mail: tobias.ham...@dlr.de _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] The `var` pattern in `match`
Having something like the var pattern can be useful for macros that expand into uses of match, if the macro doesn't want to expose that a bound variable will be a match pattern and therefore must not be _ or Granted, there are ways around this, but personally I think it would be nice if match supported this pattern. I would, however, entirely support renaming this pattern to something more obscure, like match:pattern-variable or something, so that unintentional uses stop being a problem. Carl Eastlund On Thu, Nov 29, 2012 at 12:17 AM, Neil Toronto neil.toro...@gmail.comwrote: On 11/28/2012 06:04 PM, David Van Horn wrote: On 11/28/12 7:53 PM, Sam Tobin-Hochstadt wrote: Currently, `match` provides a pattern named `var`, which makes `(var id)` equivalent to `id`, but without special cases for things like `_` and `...`. However, this frequently conflicts with structures that people define, and is rarely used other than accidentally. I'd therefore like to remove it entirely. + (expt 2 (expt 2 (expt 2 (expt 2 2 Since I've never used `var' and it sounds like a great idea to get rid of it, I'll see David's repeated exponential and raise it by \aleph_0. Note that downvotes must now at least sum to \aleph_1 to retain the `var' pattern. One downvote for every real number is sufficient. Neil ⊥ _ Racket Developers list: http://lists.racket-lang.org/**dev http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] for loop singleton optimization
That's not free-identifier=? so it wouldn't be optimized. -Ian - Original Message - From: Tobias Hammer tobias.ham...@dlr.de To: Matthew Flatt mfl...@cs.utah.edu, J. Ian Johnson i...@ccs.neu.edu Cc: dev dev@racket-lang.org Sent: Thursday, November 29, 2012 4:49:15 AM GMT -05:00 US/Canada 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 with this change since it's always 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 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 to (define-sequence-syntax *in-set (lambda () #'in-set) (lambda (stx) (syntax-case stx (set) [[(id) (_ (set v))] #`[(id) (in-value v)]] [[(id) (_ st)] At Wed, 28 Nov 2012 12:50:49 -0500 (EST), J. Ian Johnson wrote: 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 real time: 338 gc time: 16 (time (for ([n (in-range 1 100)]) (for ([k (in-value n)]) (random k cpu time: 120 real time: 118 gc time: 0 Is this easily added to for.rkt? -Ian _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev -- - Tobias Hammer DLR / Institute of Robotics and Mechatronics Muenchner Str. 20, D-82234 Wessling Tel.: 08153/28-1487 Mail: tobias.ham...@dlr.de _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Missing spel cheker
There should be an menu item about fourth from the end called Spell Check String Constants. It won't work if you don't have aspell installed, however. Do you have it installed? If so, I'm guessing it probably still won't work because it won't find the binary, sadly. I don't have cygwin on my windows box but if you run into problems I'll have a look. Thanks, Robby On Thu, Nov 29, 2012 at 4:09 AM, Pierpaolo Bernardi olopie...@gmail.com wrote: Hi, in the release notes of 5.3.1, there's: • DrRacket can spell-check string constants (enable this in the Edit menu). I can't find anything related in the Edit menu, and searching for spell in the help desk turns out empty. (On Windows, in case it matters). Cheers P. _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Planet 2 Beta Release
I've pushed a few changes in consultation with Jay. The changes are small, so far, but the most prominent change is that the interpretation of a package source is now determined syntactically. If you want to install from a local directory fish-tank, you need to write raco pkg install fish-tank/ or raco pkg install --type dir fish-tank because raco pkg install fish-tank will always contact the package name service to try to resolve fish-tank. _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Missing spel cheker
On Thu, Nov 29, 2012 at 2:46 PM, Robby Findler ro...@eecs.northwestern.edu wrote: There should be an menu item about fourth from the end called Spell Check String Constants. Not in my case. It won't work if you don't have aspell installed, however. That's my case! Cheers P. _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] The `var` pattern in `match`
+1 On Nov 29, 2012, at 7:31 AM, Carl Eastlund wrote: Having something like the var pattern can be useful for macros that expand into uses of match, if the macro doesn't want to expose that a bound variable will be a match pattern and therefore must not be _ or Granted, there are ways around this, but personally I think it would be nice if match supported this pattern. I would, however, entirely support renaming this pattern to something more obscure, like match:pattern-variable or something, so that unintentional uses stop being a problem. Carl Eastlund On Thu, Nov 29, 2012 at 12:17 AM, Neil Toronto neil.toro...@gmail.com wrote: On 11/28/2012 06:04 PM, David Van Horn wrote: On 11/28/12 7:53 PM, Sam Tobin-Hochstadt wrote: Currently, `match` provides a pattern named `var`, which makes `(var id)` equivalent to `id`, but without special cases for things like `_` and `...`. However, this frequently conflicts with structures that people define, and is rarely used other than accidentally. I'd therefore like to remove it entirely. + (expt 2 (expt 2 (expt 2 (expt 2 2 Since I've never used `var' and it sounds like a great idea to get rid of it, I'll see David's repeated exponential and raise it by \aleph_0. Note that downvotes must now at least sum to \aleph_1 to retain the `var' pattern. One downvote for every real number is sufficient. Neil ⊥ _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev smime.p7s Description: S/MIME cryptographic signature _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] [plt] Push #25789: master branch updated
Thanks, Matthew. I should have added an empty set case too, since that allocates (as opposed to list and mlist). Submitted another pull request (this time with a test, sorry about that). -Ian - Original Message - From: mfl...@racket-lang.org To: dev@racket-lang.org Sent: Thursday, November 29, 2012 9:20:22 AM GMT -05:00 US/Canada Eastern Subject: [plt] Push #25789: master branch updated mflatt has updated `master' from 15cbfa1947 to bd16f1e302. http://git.racket-lang.org/plt/15cbfa1947..bd16f1e302 =[ 4 Commits ]== Directory summary: 25.1% collects/racket/private/ 11.7% collects/racket/ 32.6% collects/scribble/ 10.3% collects/scribblings/main/private/ 20.1% collects/tests/racket/ ~~ 889f159 J. Ian Johnson i...@ccs.neu.edu 2012-11-28 13:05 : | Singleton optimization for sequences that would allocate. : M collects/racket/private/for.rkt | 6 -- M collects/racket/set.rkt | 3 ++- ~~ 6bfc03d Matthew Flatt mfl...@racket-lang.org 2012-11-29 06:57 : | add tests for `in-list', `in-mlist', and `in-set' shortcut : M collects/tests/racket/for.rktl | 4 M collects/tests/racket/set.rktl | 1 + ~~ d6b0dfc Sam Tobin-Hochstadt sa...@racket-lang.org 2012-11-28 14:14 : | Switch to use almost-standard DOCTYPE for Scribble. | | Also switches scribble search trampoline to standard DOCTYPE. | | Scribble's HTML output currently relies on the quirks-mode | box model for layout of the many tables used in rendering. | However, Scribble doesn't need the rest of the changes in | browser quirks modes, so we choose a DOCTYPE that just | changes the box model. | | It's non-obvious how to replicated this formatting with CSS | in standard-mode rendering. Probably a better long term | solution is to move away from table-based layout. | | See further discussion on GitHub pull request 158 here: | https://github.com/plt/racket/pull/158 : M collects/scribble/scribble-prefix.html| 2 +- M collects/scribblings/main/private/search-context.html | 2 +- ~~ bd16f1e Matthew Flatt mfl...@racket-lang.org 2012-11-29 07:18 : | scribble HTML: no extra breaking at the end of an identifier : M collects/scribble/html-render.rkt | 2 +- =[ Overall Diff ]=== collects/racket/private/for.rkt ~~~ --- OLD/collects/racket/private/for.rkt +++ NEW/collects/racket/private/for.rkt @@ -1725,7 +1725,8 @@ (define-sequence-syntax *in-list (lambda () #'in-list) (lambda (stx) - (syntax-case stx () + (syntax-case stx (list) +[[(id) (_ (list expr))] #'[(id) (:do-in ([(id) expr]) #t () #t () #t #f ())]] [[(id) (_ lst-expr)] (for-clause-syntax-protect #'[(id) @@ -1751,7 +1752,8 @@ (define-sequence-syntax *in-mlist (lambda () #'in-mlist) (lambda (stx) - (syntax-case stx () + (syntax-case stx (mlist) +[[(id) (_ (mlist expr))] #'[(id) (:do-in ([(id) expr]) #t () #t () #t #f ())]] [[(id) (_ lst-expr)] (for-clause-syntax-protect #'[(id) collects/racket/set.rkt ~~~ --- OLD/collects/racket/set.rkt +++ NEW/collects/racket/set.rkt @@ -308,7 +308,8 @@ (define-sequence-syntax *in-set (lambda () #'in-set) (lambda (stx) -(syntax-case stx () +(syntax-case stx (set) + [[(id) (_ (set expr))] #'[(id) (:do-in ([(id) expr]) #t () #t () #t #f ())]] [[(id) (_ st)] #`[(id) (:do-in collects/scribble/html-render.rkt ~ --- OLD/collects/scribble/html-render.rkt +++ NEW/collects/scribble/html-render.rkt @@ -1385,7 +1385,7 @@ (cond [(string? i) (let ([m (and (extra-breaking?) - (regexp-match-positions #rx[-:/+_]|[a-z](?=[A-Z]) i))]) + (regexp-match-positions #rx[-:/+_](?=.)|[a-z](?=[A-Z]) i))]) (if m (list* (substring i 0 (cdar m)) ;; Most browsers wrap after a hyphen. The one that collects/scribble/scribble-prefix.html ~~ --- OLD/collects/scribble/scribble-prefix.html +++ NEW/collects/scribble/scribble-prefix.html @@ -1 +1 @@ -!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; +!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; collects/scribblings/main/private/search-context.html ~ --- OLD/collects/scribblings/main/private/search-context.html +++ NEW/collects/scribblings/main/private/search-context.html @@ -1,4 +1,4 @@ -!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; +!DOCTYPE html html !-- This page serves as a trampoline - it finds an hq parameter, collects/tests/racket/for.rktl
Re: [racket-dev] The `var` pattern in `match`
On 11/29/12 7:31 AM, Carl Eastlund wrote: Having something like the var pattern can be useful for macros that expand into uses of match, if the macro doesn't want to expose that a bound variable will be a match pattern and therefore must not be _ or Granted, there are ways around this, but personally I think it would be nice if match supported this pattern. I would, however, entirely support renaming this pattern to something more obscure, like match:pattern-variable or something, so that unintentional uses stop being a problem. I think the real solution is to have (whatever name you give) `var' be something that is matched as an identifier and not a literal so that programmers can rename the pattern. But I know from talking with Sam this would be a big change for match. In the meantime, something more obscure than `var' would go a long way toward me not cursing Sam's good name every time I write an AST. David _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] The `var` pattern in `match`
On Thu, Nov 29, 2012 at 10:40 AM, David Van Horn dvanh...@ccs.neu.edu wrote: On 11/29/12 7:31 AM, Carl Eastlund wrote: Having something like the var pattern can be useful for macros that expand into uses of match, if the macro doesn't want to expose that a bound variable will be a match pattern and therefore must not be _ or Granted, there are ways around this, but personally I think it would be nice if match supported this pattern. I would, however, entirely support renaming this pattern to something more obscure, like match:pattern-variable or something, so that unintentional uses stop being a problem. I think the real solution is to have (whatever name you give) `var' be something that is matched as an identifier and not a literal so that programmers can rename the pattern. But I know from talking with Sam this would be a big change for match. Making `var` specifically be matched by binding would be possible -- it would be less of a change than removing it entirely. -- sam th sa...@ccs.neu.edu _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] The `var` pattern in `match`
On 11/29/12 1:45 PM, Sam Tobin-Hochstadt wrote: On Thu, Nov 29, 2012 at 10:40 AM, David Van Horn dvanh...@ccs.neu.edu wrote: On 11/29/12 7:31 AM, Carl Eastlund wrote: Having something like the var pattern can be useful for macros that expand into uses of match, if the macro doesn't want to expose that a bound variable will be a match pattern and therefore must not be _ or Granted, there are ways around this, but personally I think it would be nice if match supported this pattern. I would, however, entirely support renaming this pattern to something more obscure, like match:pattern-variable or something, so that unintentional uses stop being a problem. I think the real solution is to have (whatever name you give) `var' be something that is matched as an identifier and not a literal so that programmers can rename the pattern. But I know from talking with Sam this would be a big change for match. Making `var` specifically be matched by binding would be possible -- it would be less of a change than removing it entirely. I would still like the default to be something other than `var'. (BTW, it looks like `var' is not an indexed term in the docs for match.) David _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] [racket-bug] all/13315: TR error messages from raco setup unhelpful
On 2012-11-29 10:06:49 +0100, Michael Sperber wrote: Sam also asked about the REPL output: (queue 1 2 3) - : (Queue Any) #Queue I gather that in earlier versions of Racket, I'd get (Queue Positive-Byte) or something similar. Is (ann (queue 1 2 3) (Queue Integer)) the right fix for this? It seems awfully awkward. This should be fixed in the pre-release version of Racket. There was a regression where type information wasn't communicated properly across modules. Cheers, Asumu _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Planet 2 Beta Release
On 2012-11-29 06:52:07 -0700, Matthew Flatt wrote: The changes are small, so far, but the most prominent change is that the interpretation of a package source is now determined syntactically. If you want to install from a local directory fish-tank, you need to write raco pkg install fish-tank/ This is nice, I've been confused by the old behavior before. One thing that doesn't work (in either the old or current setup) is paths with . or ..: raco pkg install ./ raco pkg install ../ Also, is there any reason why the `update` command can't work with packages from local directories? Or should I just use --link for these cases? Cheers, Asumu _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Planet 2 Beta Release
On Thu, Nov 29, 2012 at 1:23 PM, Asumu Takikawa as...@ccs.neu.edu wrote: On 2012-11-29 06:52:07 -0700, Matthew Flatt wrote: The changes are small, so far, but the most prominent change is that the interpretation of a package source is now determined syntactically. If you want to install from a local directory fish-tank, you need to write raco pkg install fish-tank/ This is nice, I've been confused by the old behavior before. One thing that doesn't work (in either the old or current setup) is paths with . or ..: raco pkg install ./ raco pkg install ../ Also, is there any reason why the `update` command can't work with packages from local directories? It assumes that the directory won't be there anymore... I guess that's a bad assumption. Or should I just use --link for these cases? That is my suggestion to developers. I think all installed packages should be either local links or named by the naming service. All the other package source modes are for people doing creative things, like maintaining their own sets of packages for deployments, etc. Jay Cheers, Asumu _ Racket Developers list: http://lists.racket-lang.org/dev -- Jay McCarthy j...@cs.byu.edu Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay The glory of God is Intelligence - DC 93 _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Planet 2 Beta Release
On 2012-11-29 13:28:03 -0700, Jay McCarthy wrote: That is my suggestion to developers. I think all installed packages should be either local links or named by the naming service. All the other package source modes are for people doing creative things, like maintaining their own sets of packages for deployments, etc. Could --link be the default for local directory packages then? Cheers, Asumu _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] splicing-syntax-parameterize and syntax-parameter-value
(require racket/stxparam racket/splicing) (define-syntax-parameter f #f) (splicing-syntax-parameterize ([f #t]) (begin-for-syntax (printf ~a~% (syntax-parameter-value #'f))) (void)) This prints #f. If I instead add a macro indirection (define-syntax (blah stx) (syntax-case stx () [(_ f) (printf ~a~% (syntax-parameter-value #'f)) #'(void)])) Then (splicing-syntax-parameterize ([f #t]) (blah f) (void)) prints #t This is messing up some of my syntax parameters that build their definitions from the existing value in the parameter. Why does the first program have this behavior? This feels bug-like to me. -Ian _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] Square-bracket-sensitive macros in Scribble sandboxes
I've pretty much made up my mind on this, so please don't feel like you have to take time to respond point-by-point. Unless you've seen a gaping hole in my reasoning, anyway, then by all means, have at it. On 11/26/2012 05:41 PM, Eli Barzilay wrote: Two hours ago, Neil Toronto wrote: For example, it's common to have arrays of Indexes, or (Vectorof Index), which would have to print like this with implicit quoting: (array `#[,'#(0 0) ,'#(0 1)]) Just working out the algorithm to print such a thing made me want to curl up and whimper. Three sidenotes: 1. You probably mean (array `#[,`#(0 0) ,`#(0 1)]), right? The inner quasiquotes can be quotes because #(0 0) and #(0 1) are vectors, not array rows. If they were array rows, they still shouldn't need to be quasiquoted. Well, depending on design... Array rows don't exist as separate objects (an array is just a function), so I have a hard time intuiting what it means to quote the inner ones. But here are some (just some) design options: 1. Allow a quote just on the outer #[...] and have it apply to all nested #[...]. 2. Allow a quote on the outer #[...] and have it apply to all nested #[...], but allow them to override with their own quotes. 3. Allow quotes at any level, unpropagated. 4. Avoid difficulty altogether by having array syntax not quote its elements. #1 might be easy. #2 might be cool, but complicated. #3 is kind of weird, and I think it means the only quotes that matter are the innermost. For all of these, there are additional design options. For example, for #3, should quasiquoting outer rows be necessary if you want to quasiquote inner ones? For #2, how would one spell override in a way that distinguishes it from element? #4 avoids all these choices, and that's what is currently implemented. 3. And besides, doing such algorithms is usually easier than it sounds. (And IME, they're a perfect example where developement with test cases makes things way easier...) I'm okay with inventing apparently complicated recursive algorithms that eventually come down to a few well-chosen rules. (That's language semantics in a nutshell.) My problem has been *coming up with the test cases* for the various options I listed above. Now, I know where your brain just went, so let me head it off. You were about to reply with a bunch of starter test cases or a load of helpful hints. (Because that's who you are... and I appreciate it!) Let me make a case for not developing another set of array parsing/printing algorithms first, starting with your example: For example, I'll need to write something like (define (±1 i) (array `#(,(sub1 i) ,i ,(add1 i make it return a 3x3 array, and you get some less convenient thing like (define 1- sub1) (define 1+ add1) (define (±1 i j) (array `#(#(,(list (1- i) (1- j)) ,(list i (1- j)) ,(list (1+ i) (1- j))) #(,(list (1- i) j ) ,(list i j ) ,(list (1+ i) j )) #(,(list (1- i) (1+ j)) ,(list i (1+ j)) ,(list (1+ i) (1+ j)) I wouldn't want to write that, either. Right now, you'd write (array #[#[(list (1- i) (1- j)) (list i (1- j)) (list (1+ i) (1- j))] #[(list (1- i) j ) (list i j ) (list (1+ i) j )] #[(list (1- i) (1+ j)) (list i (1+ j)) (list (1+ i) (1+ j))]]) The vector syntax just delimits rows; it never quotes. Square parens aren't required, but make rows easier to distinguish. Arrays' custom printers print square parens, which gives feedback when a user is confused about whether #(...) means a row or a vector-valued element. Quotes and quasiquotes stop the `array' macro's recursion into rows, so quotes always mean this is an element. For example, this is a zero-dimensional array that contains a vector: (array '#(0 1 2 3)) Here are my reasons for leaving it as it is: * Most array elements will be self-quoting anyway (numbers, strings, other primitive types). * It's easy enough to remember the exception quote literal vectors. Also, Racket's printer writes an explicit quote before literal vectors, so arrays of array indexes parse and print the same. * I'm having a hard time with test cases for implicitly quoted array rows, which means math/array users would probably have a hard time reasoning about it as well. * There are enough possible design choices that give rise to similar- but-subtly different behavior that it would be easy for users to get confused about the actual rules. At any rate, I'm all for simple. Thanks for hashing this out with me. Neil ⊥ _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] String search in mred/private/wxme: knuth-bendix?!
I'm staring at do-find-string-all's implementation, and right before the string-matching logic, there's a mysterious comment Knuth Bendix in there. I'm staring at the code some more, and it looks more like KMP (Knuth-Morris-Pratt) to me. (I have no idea what the Knuth-Bendix algorithm looks like, but I'm pretty sure it has little to do with string matching: it's supposed to be an algorithm for solving a system of equations...) Assuming that it is KMP, is there a reason why we're not using Boyer-Moore here instead? My understanding was BM was faster than KMP for common situations. _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] String search in mred/private/wxme: knuth-bendix?!
At Thu, 29 Nov 2012 15:22:17 -0700, Danny Yoo wrote: I'm staring at do-find-string-all's implementation, and right before the string-matching logic, there's a mysterious comment Knuth Bendix in there. I'm staring at the code some more, and it looks more like KMP (Knuth-Morris-Pratt) to me. Yes, I wrote the wrong algorithm name in the comment. Assuming that it is KMP, is there a reason why we're not using Boyer-Moore here instead? My understanding was BM was faster than KMP for common situations. KMP is just the algorithm I knew at the time. Since `find-string' can find editor:info-mixin searching% at the end of collects/frameworks/private/text.rkt in 15-20ms, I doubt that it has been a bottleneck for, say, searching in DrRacket. _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] splicing-syntax-parameterize and syntax-parameter-value
Simpler example: (require racket/splicing racket/stxparam) (define-syntax-parameter f #f) (define x 0) ;; 0 (syntax-parameterize ([f (make-rename-transformer #'x)]) (splicing-syntax-parameterize ([f (syntax-parameter-value #'f)]) f)) ;; 0 (splicing-syntax-parameterize ([f (make-rename-transformer #'x)]) (syntax-parameterize ([f (syntax-parameter-value #'f)]) f)) ;; error (splicing-syntax-parameterize ([f (make-rename-transformer #'x)]) (splicing-syntax-parameterize ([f (syntax-parameter-value #'f)]) f)) stdin::334: f: bad syntax in: f context...: /home/ianj/racket/collects/racket/splicing.rkt:224:0 /home/ianj/racket/collects/racket/splicing.rkt:177:0 /home/ianj/racket/collects/racket/splicing.rkt:224:0 /home/ianj/racket/collects/racket/splicing.rkt:177:0 /home/ianj/racket/collects/racket/private/misc.rkt:87:7 -Ian - Original Message - From: J. Ian Johnson i...@ccs.neu.edu To: dev dev@racket-lang.org Sent: Thursday, November 29, 2012 4:01:09 PM GMT -05:00 US/Canada Eastern Subject: [racket-dev] splicing-syntax-parameterize and syntax-parameter-value (require racket/stxparam racket/splicing) (define-syntax-parameter f #f) (splicing-syntax-parameterize ([f #t]) (begin-for-syntax (printf ~a~% (syntax-parameter-value #'f))) (void)) This prints #f. If I instead add a macro indirection (define-syntax (blah stx) (syntax-case stx () [(_ f) (printf ~a~% (syntax-parameter-value #'f)) #'(void)])) Then (splicing-syntax-parameterize ([f #t]) (blah f) (void)) prints #t This is messing up some of my syntax parameters that build their definitions from the existing value in the parameter. Why does the first program have this behavior? This feels bug-like to me. -Ian _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] standard-module-name-resolver: collection not found after raco exe/distribute
Hello, I wasn't sure if this or the users list was the right mailing list for bug reports so I guessed a bit. After passing a project through raco exe and raco distribute (Racket 5.3.1), I get the following output right after invoking the resulting executable: standard-module-name-resolver: collection not found collection: racket/match in collection directories: C:\_GitRepos\Kanjiget\win\out\lib\plt\kanjiget\collects context...: standard-module-name-resolver #%embedded:g3796:wiktionaryviewer: [running body] #%mzc:kanjiget: [traversing imports] loop The project runs fine in DrRacket and from racket CLI and the issue is reproducible on two different computers (both Windows). Another of my projects does result in working executables so it looks to be some sort of corner case. I have the redirected output from raco make/exe/distribute and the project's source code is available online for error reproduction if that helps:.http://github.com/edwardlblake/kanjiget Thank you for your time! _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] String search in mred/private/wxme: knuth-bendix?!
On Thu, Nov 29, 2012 at 5:15 PM, Matthew Flatt mfl...@cs.utah.edu wrote: Assuming that it is KMP, is there a reason why we're not using Boyer-Moore here instead? My understanding was BM was faster than KMP for common situations. IIUC, the BM speedup comes from skipping over portions of the text. In our case, that could be handy when you skip entire snips, but if you don't skip them, then I think it wouldn't really help at all. And I think you skip things that are at most the length of the search string, so it won't help that much in practice for DrRacket. ... I think. KMP is just the algorithm I knew at the time. Since `find-string' can find editor:info-mixin searching% at the end of collects/frameworks/private/text.rkt in 15-20ms, I doubt that it has been a bottleneck for, say, searching in DrRacket. I do agree that the searching algorithm doesn't seem to be a limiting factor, but I don't think this analysis is quite right. Two points: I assume you did this test with a text% object. In DrRacket, of course, it colors the buffer, which means 3.5 times as many snips, which seems to take about twice as long (I believe that if every snip is one character things can get really bad but that's not common). Still not too bad, but the other is that when someone types something in DrRacket, it searches interactively and it finds all of the results, not just the first hit. I can get this to take in 100s of milliseconds on big files if I type things like a space, which starts to matter. Of course, since I've been in that kind of mood, DrRacket can now break these callbacks up, it shouldn't be a problem in practice. (There is still some hidden sluggishness in DrRacket surrounding searching tho. I think. I haven't been able to put my finger on it yet.) Robby _ Racket Developers list: http://lists.racket-lang.org/dev