[racket-dev] DrDr / GR2 status

2010-11-09 Thread Jay McCarthy
You may be noticing that there is a lot of noise coming from DrDr right now.

There are three kinds of problems:

1. The platform specific GUI wrappers needed to be disabled, but since
the prop file is part of the repository, it will be a while before
DrDr is building a version where it is disabled.

2. There are a few real problems with gr2:

http://drdr.racket-lang.org/21452/collects/tests/gracket/dc.rktl
http://drdr.racket-lang.org/21452/collects/tests/plot/run-tests.rkt
http://drdr.racket-lang.org/21452/collects/2htdp/tests/test-image.rkt

3. For some reason my X11 environment is really slow. I'm interested
if anyone knows how to make this better. Here's the scoop:

I used to use Xvfb, but it doesn't support RANDR (despite what the
Ubuntu bug database says), which gr2 needs.

I switched to Xorg with a dummy video card, but for some reason after
a while it takes an eternity for clients to connect to it. I have no
idea why. My next experiment will be that it is a problem with
fluxbox, the wm DrDr uses. [I needed a wm with Xvfb so that tests
could get focus. Apparently there is no focus on plain X11.]

I could try a vnc server and I may if I can't debug the Xorg problem.
Hopefully the problem won't be replicated there.

Jay

-- 
Jay McCarthy 
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] Simple loop checking in beginner?

2010-11-09 Thread John Clements
Here's a simple macro that prevents same-argument recursive calls (including 
non-tail ones).  It's illustrated by a student function that made a teeny 
mistake which would result in looping forever, but (using this macro) instead 
signals an error.  To the best of my limited knowledge, beginner is purely 
functional aside from the use of the test functions, right? So any recursive 
call with eq? args is guaranteed to loop forever, right?

Hmm... well, I suppose there's (random)... 

It seems to me that a macro like this one (or even complete memoization) could 
potentially reduce student frustration, and would not prevent students from 
writing the programs that they wanted to.

No?

John Clements



#lang racket

(require rackunit)

(define-syntax (define/noloop stx)
  (syntax-case stx ()
[(_ (funname arg ...) body ...)
 #`(define funname
 (let ()
   (define fresh-key (gensym 'funname))
   (define (funname arg ...)
 (let* ([most-recent-args (continuation-mark-set-first #f 
fresh-key)]
[these-args (list arg ...)])
   (when (and most-recent-args
  (= (length these-args)
 (length most-recent-args))
  (andmap eq? these-args most-recent-args))
 (error 'funname "recursive call with identical arguments ~s is 
guaranteed to run forever." these-args))
   (with-continuation-mark fresh-key these-args
 body
 ...)))
   funname))]))

;; NOW I'M A STUDENT:

;; only-long-strings : (listof string) -> (listof string)
;; return a list containing the strings longer than 2 chars
(define/noloop (only-long-strings l)
  (cond [(empty? l) empty]
[else (cond [(< 2 (string-length (first l))) 
 (cons (first l) 
   (only-long-strings (rest l)))]
[else (only-long-strings l)])]))


(check-equal? (only-long-strings (cons "abc" (cons "de" (cons "fgh" empty
  (cons "abc" (cons "fgh" empty)))

smime.p7s
Description: S/MIME cryptographic signature
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] try the GRacket2 branch

2010-11-09 Thread Jose A. Ortega Ruiz
On Wed, Nov 10 2010, Matthew Flatt wrote:

> I should have paid more attention to your observation that it might be
> related to sawfish. Eli ran into the same problem, and the latest
> development version now avoids annoying sawfish. Let me know if you
> still see problems.

Ah, lucky me: it does indeed work here too. Thanks a lot!

jao
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] [plt] Push #21491: master branch updated

2010-11-09 Thread Matthew Flatt
Supply #f as the first argument to `raise-syntax-error'.

At Tue, 09 Nov 2010 17:31:51 -0700, Jon Rafkind wrote:
> It occured to me while making this small patch that the name of the
> macro shown in the error message might not be the same as the one the
> user called. Namely, if the user renames or prefixes the macro when
> requiring it then they will get a mismatch. This seems to be consistent
> with how `raise-syntax-error' already works though so is it a big deal?
> 
> On 11/09/2010 05:26 PM, rafk...@racket-lang.org wrote:
> > rafkind has updated `master' from 3936a40717 to 81eac261dc.
> >   http://git.racket-lang.org/plt/3936a40717..81eac261dc
> >
> > =[ 1 Commits ]==
> >
> > Directory summary:
> >  100.0% collects/racket/private/
> >
> > ~~
> >
> > 81eac26 Jon Rafkind  2010-11-09 17:23
> > :
> > | better error message for define-syntax-rule
> > :
> >   M collects/racket/private/misc.rkt |   22 --
> >
> > =[ Overall Diff ]===
> >
> > collects/racket/private/misc.rkt
> > 
> > --- OLD/collects/racket/private/misc.rkt
> > +++ NEW/collects/racket/private/misc.rkt
> > @@ -12,18 +12,20 @@
> >(define-syntax define-syntax-rule
> >  (lambda (stx)
> >(syntax-case stx ()
> > -[(dr (foo . pattern) template)
> > - (identifier? #'foo)
> > +[(dr (name . pattern) template)
> > + (identifier? #'name)
> >   (syntax/loc stx
> > -   (define-syntax foo
> > - (lambda (x)
> > -   (syntax-case** dr #t x () free-identifier=?
> > -  [(_ . pattern) (syntax/loc x template)]]
> > -[(dr (foo . pattern) template)
> > - (raise-syntax-error 'define-syntax-rule "expected an identifier" 
> stx #'foo)]
> > -[(dr (foo . pattern))
> > +   (define-syntax name
> > + (lambda (user)
> > +   (syntax-case** dr #t user () free-identifier=?
> > +  [(_ . pattern) (syntax/loc user template)]
> > +  [else (raise-syntax-error 'name (format "~a 
> did not match pattern ~a" (syntax->datum user) '(name . pattern)))]
> > +  ]
> > +[(dr (name . pattern) template)
> > + (raise-syntax-error 'define-syntax-rule "expected an identifier" 
> stx #'name)]
> > +[(dr (name . pattern))
> >   (raise-syntax-error 'define-syntax-rule "no template provided" 
> stx)]
> > -[(dr (foo . pattern) template . etc)
> > +[(dr (name . pattern) template . etc)
> >   (raise-syntax-error 'define-syntax-rule "too many templates" stx 
> #'etc)]
> >  [(dr head . template)
> >   (raise-syntax-error 'define-syntax-rule "invalid pattern" stx 
> #'head)])))
> 
> _
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/dev
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] [plt] Push #21491: master branch updated

2010-11-09 Thread Jon Rafkind
It occured to me while making this small patch that the name of the
macro shown in the error message might not be the same as the one the
user called. Namely, if the user renames or prefixes the macro when
requiring it then they will get a mismatch. This seems to be consistent
with how `raise-syntax-error' already works though so is it a big deal?

On 11/09/2010 05:26 PM, rafk...@racket-lang.org wrote:
> rafkind has updated `master' from 3936a40717 to 81eac261dc.
>   http://git.racket-lang.org/plt/3936a40717..81eac261dc
>
> =[ 1 Commits ]==
>
> Directory summary:
>  100.0% collects/racket/private/
>
> ~~
>
> 81eac26 Jon Rafkind  2010-11-09 17:23
> :
> | better error message for define-syntax-rule
> :
>   M collects/racket/private/misc.rkt |   22 --
>
> =[ Overall Diff ]===
>
> collects/racket/private/misc.rkt
> 
> --- OLD/collects/racket/private/misc.rkt
> +++ NEW/collects/racket/private/misc.rkt
> @@ -12,18 +12,20 @@
>(define-syntax define-syntax-rule
>  (lambda (stx)
>(syntax-case stx ()
> -[(dr (foo . pattern) template)
> - (identifier? #'foo)
> +[(dr (name . pattern) template)
> + (identifier? #'name)
>   (syntax/loc stx
> -   (define-syntax foo
> - (lambda (x)
> -   (syntax-case** dr #t x () free-identifier=?
> -  [(_ . pattern) (syntax/loc x template)]]
> -[(dr (foo . pattern) template)
> - (raise-syntax-error 'define-syntax-rule "expected an identifier" 
> stx #'foo)]
> -[(dr (foo . pattern))
> +   (define-syntax name
> + (lambda (user)
> +   (syntax-case** dr #t user () free-identifier=?
> +  [(_ . pattern) (syntax/loc user template)]
> +  [else (raise-syntax-error 'name (format "~a 
> did not match pattern ~a" (syntax->datum user) '(name . pattern)))]
> +  ]
> +[(dr (name . pattern) template)
> + (raise-syntax-error 'define-syntax-rule "expected an identifier" 
> stx #'name)]
> +[(dr (name . pattern))
>   (raise-syntax-error 'define-syntax-rule "no template provided" stx)]
> -[(dr (foo . pattern) template . etc)
> +[(dr (name . pattern) template . etc)
>   (raise-syntax-error 'define-syntax-rule "too many templates" stx 
> #'etc)]
>  [(dr head . template)
>   (raise-syntax-error 'define-syntax-rule "invalid pattern" stx 
> #'head)])))

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] try the GRacket2 branch

2010-11-09 Thread Matthew Flatt
I should have paid more attention to your observation that it might be
related to sawfish. Eli ran into the same problem, and the latest
development version now avoids annoying sawfish. Let me know if you
still see problems.

At Sat, 30 Oct 2010 20:31:43 +0200, "Jose A. Ortega Ruiz" wrote:
> On Sat, Oct 30 2010, Matthew Flatt wrote:
> 
> > At Fri, 29 Oct 2010 01:04:02 +0200, "Jose A. Ortega Ruiz" wrote:
> >> In a build from a checkout of a few minutes ago, drracket dies on me
> >> when i try to resize its window, with the following message to the
> >> console:
> >> 
> >> The program '' received an X Window System error.
> >> This probably reflects a bug in the program.
> >> The error was 'BadMatch (invalid parameter attributes)'.
> >>   (Details: serial 4084 error_code 8 request_code 59 minor_code 0)
> >>   (Note to programmers: normally, X errors are reported asynchronously;
> >>that is, you will receive the error a while after causing it.
> >>To debug your program, run it with the --sync command line
> >>option to change this behavior. You can then get a meaningful
> >>backtrace from your debugger if you break on the gdk_x_error()
> >>function.)
> >> 
> >> I've tried to pass --sync to drracket, but it complains that the flag is
> >> not recognized.
> >> 
> >> This is on a debian unstable box with gtk 2.20.1.
> >
> > This happens consistently for you, I guess? I tried a Debian Unstable
> > install (with Gtk 2.20.1), and it worked ok for me, so I'm not sure
> > what's different.
> 
> Yes, it happens all the time. I just tried with plain gracket, and it
> displays an error that might be more informative (this, again, happens
> when i try to resize the main window):
> 
> > ./gracket
> make-bytes: out of memory making byte string of length 17169122912
> 
>  === context ===
> /home/jao/src/scheme/racket/collects/racket/draw/private/bitmap.rkt:66:2
> /home/jao/src/scheme/racket/collects/racket/private/class-internal.rkt:3596:0:
> continue-make-super
> /home/jao/src/scheme/racket/collects/mred/private/wx/gtk/dc.rkt:27:2
> /home/jao/src/scheme/racket/collects/racket/private/class-internal.rkt:3546:0:
> continue-make-object
> /home/jao/src/scheme/racket/collects/racket/private/class-internal.rkt:3468:2:
> make-object
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/backing-dc.rkt:106:4
> :
> get-cr method in backing-dc%
> /home/jao/src/scheme/racket/collects/racket/draw/private/dc.rkt:623:4:
> set-clipping-rect method in dc%
> /home/jao/src/scheme/racket/collects/mred/private/wxme/text.rkt:4933:2:
> refresh method in text%
> /home/jao/src/scheme/racket/collects/mred/private/wxme/editor-canvas.rkt:586:2:
> redraw method in editor-canvas%
> /home/jao/src/scheme/racket/collects/mred/private/wxme/text.rkt:2503:2:
> set-max-width method in text%
> /home/jao/src/scheme/racket/collects/racket/private/more-scheme.rkt:149:2:
> call-with-break-parameterization
> /home/jao/src/scheme/racket/collects/racket/private/more-scheme.rkt:265:2:
> call-with-exception-handler
> /home/jao/src/scheme/racket/collects/racket/private/more-scheme.rkt:149:2:
> call-with-break-parameterization
> /home/jao/src/scheme/racket/collects/racket/private/more-scheme.rkt:265:2:
> call-with-exception-handler
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/queue.rkt:359:7
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/queue.rkt:396:26
> 
> make-bytes: out of memory making byte string of length 17169122912
> 
>  === context ===
> /home/jao/src/scheme/racket/collects/racket/draw/private/bitmap.rkt:66:2
> /home/jao/src/scheme/racket/collects/racket/private/class-internal.rkt:3596:0:
> continue-make-super
> /home/jao/src/scheme/racket/collects/mred/private/wx/gtk/dc.rkt:27:2
> /home/jao/src/scheme/racket/collects/racket/private/class-internal.rkt:3546:0:
> continue-make-object
> /home/jao/src/scheme/racket/collects/racket/private/class-internal.rkt:3468:2:
> make-object
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/backing-dc.rkt:106:4
> :
> get-cr method in backing-dc%
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/canvas-mixin.rkt:137
> :13
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/queue.rkt:359:7
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/queue.rkt:396:26
> 
> on-size in window<%>: expected argument of type  1]>; given 65535
> 
>  === context ===
> /home/jao/src/scheme/racket/collects/mred/private/mrwindow.rkt:144:17:
> on-size method in ...private/mrwindow.rkt:127:4
> /home/jao/src/scheme/racket/collects/racket/private/more-scheme.rkt:149:2:
> call-with-break-parameterization
> /home/jao/src/scheme/racket/collects/racket/private/more-scheme.rkt:265:2:
> call-with-exception-handler
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/queue.rkt:359:7
> /home/jao/src/scheme/racket/collects/mred/private/wx/common/queue.rkt:396:26
> 
> > Instead of `--sync', you could provide the `-synchronous' option (i.e,
> > the 

Re: [racket-dev] [plt] Push #21487: master branch updated

2010-11-09 Thread Casey Klein
Oops! That'll teach me to try to fix code I don't know how to run.

On Tue, Nov 9, 2010 at 2:54 PM, Jay McCarthy  wrote:
> You cannot reverse a sequence. You meant (in-list (reverse ...))
>
> Jay
>
> On Tue, Nov 9, 2010 at 1:49 PM,   wrote:
>> clklein has updated `master' from 02f301b3b7 to 0d1578cbb1.
>>  http://git.racket-lang.org/plt/02f301b3b7..0d1578cbb1
>>
>> =[ 1 Commits ]==
>>
>> Directory summary:
>>  100.0% collects/meta/drdr/graphs/
>>
>> ~~
>>
>> 0d1578c Casey Klein  2010-11-09 14:46
>> :
>> | Displays the panes in descending order (to match graph's time axis)
>> :
>>  M collects/meta/drdr/graphs/build-graph.ss |    2 +-
>>
>> =[ Overall Diff ]===
>>
>> collects/meta/drdr/graphs/build-graph.ss
>> 
>> --- OLD/collects/meta/drdr/graphs/build-graph.ss
>> +++ NEW/collects/meta/drdr/graphs/build-graph.ss
>> @@ -614,7 +614,7 @@
>>            (span ((id "rev_and_duration")) ""))
>>       (tt (span ((id "timings")) ""))
>>
>> -      ,@(for/list ((graphs (in-list graphss))
>> +      ,@(for/list ((graphs (reverse (in-list graphss)))
>>                    (i (in-naturals)))
>>           `(map ((name ,(format "revmap~a" i)))
>>                 ,@(graphs->areas graphs i)))
>>
>
>
>
> --
> Jay McCarthy 
> Assistant Professor / Brigham Young University
> http://faculty.cs.byu.edu/~jay
>
> "The glory of God is Intelligence" - D&C 93
>
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] [plt] Push #21487: master branch updated

2010-11-09 Thread Jay McCarthy
You cannot reverse a sequence. You meant (in-list (reverse ...))

Jay

On Tue, Nov 9, 2010 at 1:49 PM,   wrote:
> clklein has updated `master' from 02f301b3b7 to 0d1578cbb1.
>  http://git.racket-lang.org/plt/02f301b3b7..0d1578cbb1
>
> =[ 1 Commits ]==
>
> Directory summary:
>  100.0% collects/meta/drdr/graphs/
>
> ~~
>
> 0d1578c Casey Klein  2010-11-09 14:46
> :
> | Displays the panes in descending order (to match graph's time axis)
> :
>  M collects/meta/drdr/graphs/build-graph.ss |    2 +-
>
> =[ Overall Diff ]===
>
> collects/meta/drdr/graphs/build-graph.ss
> 
> --- OLD/collects/meta/drdr/graphs/build-graph.ss
> +++ NEW/collects/meta/drdr/graphs/build-graph.ss
> @@ -614,7 +614,7 @@
>            (span ((id "rev_and_duration")) ""))
>       (tt (span ((id "timings")) ""))
>
> -      ,@(for/list ((graphs (in-list graphss))
> +      ,@(for/list ((graphs (reverse (in-list graphss)))
>                    (i (in-naturals)))
>           `(map ((name ,(format "revmap~a" i)))
>                 ,@(graphs->areas graphs i)))
>



-- 
Jay McCarthy 
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] saving .scrbl file OS X message box

2010-11-09 Thread Robby Findler
I don't understand how I can call get-file differently to improve what
seems to be happening currently under mac os x. In particular, when I
try to save a file "x.scrbl" it asks me if "x.rkt" is what I meant and
the default choice is to keep the scrbl extension (this is under 10.6;
maybe things are different on 10.5?)

Robby

On Mon, Nov 8, 2010 at 8:14 AM, Matthew Flatt  wrote:
> This was a bug in the `save-file' dialog under Cocoa, where the
> Cocoa-level "allow other extensions" flag wasn't set correctly. It's
> now fixed.
>
> Probably DrRacket should add ".scrbl" to its list of standard
> extensions, though.
>
> At Wed, 3 Nov 2010 14:15:34 -0700, John Clements wrote:
>> Dear Heavens, this is the most unpleasant message box I've seen in a while,
>> when trying to save a file with the extension "scrbl" in OS X 10.6.4:
>>
>> You cannot save this document with extension ".scrbl" at the end of the
>> name. The required extension is ".".
>>
>> You can choose to use both, so that your file name ends in ".scrbl".
>>
>>
>>
>> ... uh?
>>
>> I'm guessing that we deduced that by requiring the extension "." only, OS X
>> would allow us  to save with any extension we liked, but the resulting 
>> message
>> box is appalling; I vote for going back to what we had before
>>
>> Apologies if I'm misunderstanding something, here.
>>
>> 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