Re: [racket-dev] typed/scheme n00b question
On Tue, Sep 7, 2010 at 8:04 AM, Robby Findler ro...@eecs.northwestern.edu wrote: You can't use that type in `require/typed', though, since the contract library doesn't accept `case-' contracts like that. The like that part is that two different arms of the case- would have the same arity? Right. Of course, even if the contract library accepted such contracts when it could distinguish based on the first-order portions which case to take, that still wouldn't cover all of what TR accepts. More work is needed (on my part) to characterize it precisely, though. -- sam th sa...@ccs.neu.edu _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] typed/scheme n00b question
On Sep 7, Jay McCarthy wrote: On Tue, Sep 7, 2010 at 5:54 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: On Mon, Sep 6, 2010 at 10:28 PM, Eli Barzilay e...@barzilay.org wrote: On Sep 6, Sam Tobin-Hochstadt wrote: On Sun, Sep 5, 2010 at 5:30 PM, Eli Barzilay e...@barzilay.org wrote: I think that this is the type for `file-or-directory-modify-seconds': (case-lambda [String - Exact-Nonnegative-Integer] [String (Option Exact-Nonnegative-Integer) - (U Exact-Nonnegative-Integer Void)] [String (Option Exact-Nonnegative-Integer) (- Any) - Any]) Probably you want something more specific that handles the [String Integer] and [String False] cases separately. Yeah, but that's the part that I can never remember. This: (U (String - Exact-Nonnegative-Integer) (String False - Exact-Nonnegative-Integer) (String Exact-Nonnegative-Integer - Void) (String (Option Exact-Nonnegative-Integer) (- Any) - Any)) is more precise, but IIRC, it's not equivalent to the above -- ? Why does everyone always want to use union for this? I vaguely remembered that unions don't work for functions, and therefore didn't use one (also that ? is exactly about it.) Everything you wrote there is correct, except that `U' should be `case-lambda'. There is something to be said for making the things that everyone writes first be the thing they should write. It is natural to me to think of a function with multiple arrow types as a union of some arrow types. Would it be so hard for Typed Racket to see a union of all arrows and just consider that the same as case-lambda? Is that wrong? If it is fundamentally wrong, some better form of explanation in the docs seem warranted. +1 to all of that. [Why does everyone reminds me of a teacher who had about 112 students out of a class of 120 students fail a course -- and concluded that it was a very weak class.] -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] gitp
On Jul 8, Eli Barzilay wrote: [...something that nobody read...] That was a script that I wrote that can be used to fix file timestamps after git operations -- which is a frequent complaint (around here, at least). I have revised this script now, so instead of blindly remembering the time stamp for the last-seen hash, it remembers it for all hashes, which means that it can also be used to switch between branches, and files with the same contents will have consistent time stamps. The new version is attached, see comments in the file. Again -- if anyone has any comments, I'll be happy to hear them, including positive feedback. (Since I want to eventually raise this point on the git list.) gitp Description: Binary data -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] Nest resurrection
At some point after the Racket rename, `racket/nest' was dropped, and every once in a while I run into a case where I really miss it. So here's a shot at what went wrong and an alternative vesion. My guess is that the main thing that made it difficult to use is the fact that it used the usual let-style grouping, which can be difficult to follow when the forms in it are themselves using the same kind of grouping. The result is a kind of code that encourages parenophobia: (nest ([let ([x 5])] [let ([x (+ x x)])] [for ([x (in-range x)])] [when (even? x)]) (printf x = ~s\n x)) At some point not too long ago, there was discussion of various tricks people use to reduce such rightward drift. I remember one reader that was starting a new parenthesized expression on every `/', so (a b / c d / e f) --reads-as-- (a b (c d (e f))) IIRC, Haskell also has a `$' thing with the purpose of doing just this. So how about using a non-alphabetic name (reduces clutter that breaks reading) and using it also for the separators instead of the paren-of-parens thing that makes that mess? Using `$', it would look like this: ($ let ([x 5]) $ let ([x (+ x x)]) $ for ([x (in-range x)]) $ when (even? x) (printf x = ~s\n x)) for the above expression. Opinions? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] Nest resurrection
On Tue, Sep 7, 2010 at 8:57 AM, Eli Barzilay e...@barzilay.org wrote: At some point after the Racket rename, `racket/nest' was dropped, and every once in a while I run into a case where I really miss it. So here's a shot at what went wrong and an alternative vesion. My guess is that the main thing that made it difficult to use is the fact that it used the usual let-style grouping, which can be difficult to follow when the forms in it are themselves using the same kind of grouping. The result is a kind of code that encourages parenophobia: (nest ([let ([x 5])] [let ([x (+ x x)])] [for ([x (in-range x)])] [when (even? x)]) (printf x = ~s\n x)) At some point not too long ago, there was discussion of various tricks people use to reduce such rightward drift. I remember one reader that was starting a new parenthesized expression on every `/', so (a b / c d / e f) --reads-as-- (a b (c d (e f))) IIRC, Haskell also has a `$' thing with the purpose of doing just this. So how about using a non-alphabetic name (reduces clutter that breaks reading) and using it also for the separators instead of the paren-of-parens thing that makes that mess? Using `$', it would look like this: ($ let ([x 5]) $ let ([x (+ x x)]) $ for ([x (in-range x)]) $ when (even? x) (printf x = ~s\n x)) for the above expression. Opinions? -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! FWIW, I think nest seems less like a macro to me and more like a reader syntax. It's like our period-based infix notation; it just shuffles around s-expressions syntactically, it doesn't mess with bindings or anything else to do with semantics of an expression. --Carl _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] [racket-bug] all/11166: stepper index off by one
On Sep 7, 2010, at 6:56 AM, mlsm...@cs.vassar.edu wrote: A new problem report is waiting at http://bugs.racket-lang.org/query/?cmd=viewpr=11166 Reported by Marc Smith for release: 5.0.1 *** Description: When stepping through a program in BSL, the stepper shows current progress, e.g., 0/3, 1/3, 2/3 But since the step numbers start at 0, the progress only goes to (n-1)/n, and not n/n when the user has stepped through the entire program. I didn't notice this situation, but my students did during class, which became their first lesson in 0-based indexing (for better or worse). Thanks! Marc That was a deliberate choice, though I could be convinced that it was the wrong one; I think I was trying to mirror the behavior of the current search command. Any other opinions? John smime.p7s Description: S/MIME cryptographic signature _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] [racket-bug] all/11166: stepper index off by one
The search command got changed a little while ago, I think. :) But I think you should got from 1/n to n/n. (The text search is a little more complex because you can be before or after the first / last hit.) Robby On Tue, Sep 7, 2010 at 2:34 PM, John Clements cleme...@brinckerhoff.org wrote: On Sep 7, 2010, at 6:56 AM, mlsm...@cs.vassar.edu wrote: A new problem report is waiting at http://bugs.racket-lang.org/query/?cmd=viewpr=11166 Reported by Marc Smith for release: 5.0.1 *** Description: When stepping through a program in BSL, the stepper shows current progress, e.g., 0/3, 1/3, 2/3 But since the step numbers start at 0, the progress only goes to (n-1)/n, and not n/n when the user has stepped through the entire program. I didn't notice this situation, but my students did during class, which became their first lesson in 0-based indexing (for better or worse). Thanks! Marc That was a deliberate choice, though I could be convinced that it was the wrong one; I think I was trying to mirror the behavior of the current search command. Any other opinions? John _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] Ryan, the bug czar
I am pleased to introduce Ryan as our new bug czar. Thanks to everyone else who volunteered. -- Matthias _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] Q. about live snips
I'm writing code for beginners that produces sound values. I'd like to render these values as snips that have a start and a stop button. My first experiment looked like this: #lang racket (require racket/gui) (define f (make-object image-snip% /Users/clements/plt/collects/icons/mini-plt.xpm)) (define (g) (send f load-file /Users/clements/plt/collects/icons/j.gif)) This worked in the sense that the value was rendered graphically, but didn't work in the sense that calling (g) didn't change an already-displayed image. Viz: inline: Screen shot 2010-09-07 at 3.37.28 PM.png This suggests to me that it would be hard to implement a sound-player-snip that updated itself to display its status. My hope is that I'm wrong, and there's some easy way to make snips live in this sense. Any help greatly appreciated. John smime.p7s Description: S/MIME cryptographic signature _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] Q. about live snips
You can do that, but you need to start by making your own derived snip% instance. There's a lot of boilerplate that goes into those things, tho. Robby On Tue, Sep 7, 2010 at 5:39 PM, John Clements cleme...@brinckerhoff.org wrote: I'm writing code for beginners that produces sound values. I'd like to render these values as snips that have a start and a stop button. My first experiment looked like this: #lang racket (require racket/gui) (define f (make-object image-snip% /Users/clements/plt/collects/icons/mini-plt.xpm)) (define (g) (send f load-file /Users/clements/plt/collects/icons/j.gif)) This worked in the sense that the value was rendered graphically, but didn't work in the sense that calling (g) didn't change an already-displayed image. Viz: This suggests to me that it would be hard to implement a sound-player-snip that updated itself to display its status. My hope is that I'm wrong, and there's some easy way to make snips live in this sense. Any help greatly appreciated. John _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev