[racket] Looping and let-values

2011-10-23 Thread Jens Axel Søgaard
Hi All, I was having fun with sequece-generate* and wrote this program as an example of its use. (let-values ([(first next) (sequence-generate* '(a b c))]) (let loop ([first first] [next next]) (when first (display first) (newline) (call-with-values next loop The (let loo

Re: [racket] [typed racket] type case

2011-10-23 Thread Eric Tanter
On Oct 23, 2011, at 5:39 PM, Sam Tobin-Hochstadt wrote: > Yes, I have planned to do this for a while. Probably the form it will > take will be a macro that always produces a type error when checked, > rather than a new type. Then macros could use this form to ensure > exhaustiveness. Great! Look

Re: [racket] [typed racket] type case

2011-10-23 Thread Sam Tobin-Hochstadt
On Sun, Oct 23, 2011 at 11:03 AM, Eric Tanter wrote: > So this seems the good way to go. > > However, of course, this does not work if the return type is compatible with > Void: > > (: f ((U String Integer) -> Any)) > (define (f x) >  (cond >    [(string? x) (string=? x "hi")] >    [(exact-nonneg

Re: [racket] [typed racket] type case

2011-10-23 Thread Eric Tanter
On Oct 23, 2011, at 12:39 PM, Vincent St-Amour wrote: > Using `Any' as a return type is something I only do as a quick and > dirty solution. I assume that if you care enough to want case > exhaustiveness checking, you probably care enough to nail down your > return types precisely. Ok for Any. But

Re: [racket] Fullscreen frame and keyboard focus questions

2011-10-23 Thread Robby Findler
It might be best to create your own subclass of panel% that expects to have two children (a canvas% for drawing the background and an editor-canvas% for the text% object) that centers the editor-canvas% over the canvas%. Robby On Sun, Oct 23, 2011 at 10:17 AM, Erich Rast wrote: > Hi, > > I've go

Re: [racket] [typed racket] type case

2011-10-23 Thread Vincent St-Amour
At Sun, 23 Oct 2011 12:03:23 -0300, Eric Tanter wrote: > However, of course, this does not work if the return type is compatible with > Void: > > (: f ((U String Integer) -> Any)) > (define (f x) > (cond > [(string? x) (string=? x "hi")] > [(exact-nonnegative-integer? x) (= x 7)])) > >

[racket] Fullscreen frame and keyboard focus questions

2011-10-23 Thread Erich Rast
Hi, I've got a bit of a strange requirement. What I need: a text% with corresponding editor canvas centered on the screen filled with a background color or image. Various tools and "overlays" might show up on the background around the editor. Method 1: Make a frame% fullscreen and put vertical a

Re: [racket] [typed racket] type case

2011-10-23 Thread Eric Tanter
So this seems the good way to go. However, of course, this does not work if the return type is compatible with Void: (: f ((U String Integer) -> Any)) (define (f x) (cond [(string? x) (string=? x "hi")] [(exact-nonnegative-integer? x) (= x 7)])) typechecks. I wonder if there a trick

Re: [racket] [typed racket] type case

2011-10-23 Thread Eric Tanter
Thanks Sam, that clears things up! -- Éric On Oct 22, 2011, at 6:25 PM, Sam Tobin-Hochstadt wrote: > On Sat, Oct 22, 2011 at 2:20 PM, Eric Tanter wrote: >> On Oct 21, 2011, at 1:55 PM, Sam Tobin-Hochstadt wrote: >>> On Fri, Oct 21, 2011 at 12:44 PM, Eric Tanter wrote: In that sense, un

Re: [racket] Escaping things in templates?

2011-10-23 Thread Neil Van Dyke
As an aside, useful HTML templates don't have to be in HTML syntax; Racket programmers can do this: #lang racket/base (require (planet neil/html-template:1:0)) (define (write-fastest-in-the-west-page-html thing) (html-template (html (head (title "Fastest " (% thing) " in the West!")