Re: [racket] Box: When and why?

2010-10-21 Thread Shriram Krishnamurthi
There is a variation on what Matthias said, which is when you need a shared structure whose value changes but whose representation may contain immutable constants. Consider a queue to which you may need to store references in multiple places (including, say, a hash-table). The queue may itself be

Re: [racket] Box: When and why?

2010-10-21 Thread Matthias Felleisen
On Oct 21, 2010, at 5:48 PM, Greg Hendershott wrote: > Thank you, I understand now. > > It's interesting how little I've need to consider, so far, whether > Racket parameters are call-by-value or call-by-reference. > > If you don't use set! on parameters, one reason to consider it > disappear

Re: [racket] Box: When and why?

2010-10-21 Thread Greg Hendershott
Thank you, I understand now. It's interesting how little I've need to consider, so far, whether Racket parameters are call-by-value or call-by-reference. If you don't use set! on parameters, one reason to consider it disappears. I've been sticking to a functional style (after an initial awkward "

Re: [racket] reliable path comparison?

2010-10-21 Thread Danny Yoo
> BTW, the relevant racket function for the first part is > `file-or-directory-identity'. Ah! This is exactly what I need! Thanks! _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

Re: [racket] reliable path comparison?

2010-10-21 Thread Eli Barzilay
5 minutes ago, Joe Marshall wrote: > On Wed, Oct 20, 2010 at 7:20 PM, Danny Yoo wrote: > > I'm trying to compare two paths for equality; I misread normalize-path > > and didn't realize that it does not do case folding, so that on > > Windows, > > > >   (equal? (build-path "C:\\") > >              

Re: [racket] reliable path comparison?

2010-10-21 Thread Joe Marshall
On Wed, Oct 20, 2010 at 7:20 PM, Danny Yoo wrote: > I'm trying to compare two paths for equality; I misread normalize-path > and didn't realize that it does not do case folding, so that on > Windows, > >   (equal? (build-path "C:\\") >              (build-path "c:\\")) > > returns false.  What's t

Re: [racket] reliable path comparison?

2010-10-21 Thread Robby Findler
Normal-case-path? On Thursday, October 21, 2010, Danny Yoo wrote: > On Thu, Oct 21, 2010 at 11:23 AM, scouic wrote: >> Hi, >> i think that the problem is the \ character, because this works : >> #lang racket >> (equal? (regexp-replace* "" (path->string (build-path "C:\\")) "/") >>     (r

Re: [racket] Box: When and why?

2010-10-21 Thread Matthias Felleisen
Boxes are the closest thing to addresses you can find in Racket. You need them when you want to mimic a classical by-reference function parameter protocol. For example, (define (return-nothing x y z a-box) (set-box! a-box ComputeSomethingWith-x-y-z) (void) ;; just to make clear that not

Re: [racket] Box: When and why?

2010-10-21 Thread Greg Hendershott
P.S. Maybe a simpler example I should have used: (define next-web-parameter-id (let ([i (box 0)]) (lambda () (begin0 (unbox i) (set-box! i (add1 (unbox i))) In both examples the box is involved in a closure lambda pattern. This example, my old C/C++ brain wants to i

Re: [racket] reliable path comparison?

2010-10-21 Thread Danny Yoo
On Thu, Oct 21, 2010 at 11:23 AM, scouic wrote: > Hi, > i think that the problem is the \ character, because this works : > #lang racket > (equal? (regexp-replace* "" (path->string (build-path "C:\\")) "/") >     (regexp-replace* "" (path->string (build-path "C:\\")) "/")) > > and retu

Re: [racket] Are there any functional structs in Racket

2010-10-21 Thread Richard Cleis
On Oct 20, 2010, at 11:16 PM, Nikita B. Zuev wrote: > Thank you all for your replies. I somehow missed `struct-copy', this > is exactly what I wanted. Bad thing I can't pass lambda to it like: > > (struct-copy person > myperson > (age (lambda (age) (+ age 1 > struct

[racket] Box: When and why?

2010-10-21 Thread Greg Hendershott
Where can I find more information about the use scenarios for "box"? The Guide is terse: >> 3.11 Boxes A box is like a single-element vector. It can print as a quoted #& followed by the printed form of the boxed value. A #& form can also be used as an expression, but since the resulting box is c

Re: [racket] reliable path comparison?

2010-10-21 Thread scouic
Hi, i think that the problem is the \ character, because this works : #lang racket (equal? (regexp-replace* "" (path->string (build-path "C:\\")) "/") (regexp-replace* "" (path->string (build-path "C:\\")) "/")) and returns true have a nice day, -mw 2010/10/21 Danny Yoo > I'm t

[racket] Adding OS X linker options using raco exe

2010-10-21 Thread Norman Gray
Greetings. I'm trying to code-sign a Racket standalone server on OS X. I've got a bit stuck. I'm following the instructions at . Th

Re: [racket] Emacs-style keybindings in Windows

2010-10-21 Thread Robby Findler
On Thu, Oct 21, 2010 at 7:27 AM, Neil Van Dyke wrote: > Eric Hanchrow wrote at 10/21/2010 12:48 AM: >> >> But I can't figure out how to do what Emacs does when I type M-), namely: >> move point across one closing paren, without inserting any.  Is there an >> equivalent for that? >> > > Something l

Re: [racket] Emacs-style keybindings in Windows

2010-10-21 Thread Neil Van Dyke
Eric Hanchrow wrote at 10/21/2010 12:48 AM: But I can't figure out how to do what Emacs does when I type M-), namely: move point across one closing paren, without inserting any. Is there an equivalent for that? Something like that... In the normal DrRacket key bindings, you get equivalen

Re: [racket] Emacs-style keybindings in Windows

2010-10-21 Thread Shriram Krishnamurthi
> ... while we're on the subject, I see that M-( does in DrRacket what > it does in Emacs: inserts a () and leaves the insertion point between > them.  Splendid!  But I can't figure out how to do what Emacs does > when I type M-), namely: move point across one closing paren, without > inserting a

Re: [racket] Transparent area's

2010-10-21 Thread Christophe Vandenberghe
Hi, Yeah, if you want to draw some text that's fine. But even if you want to import an image that has a transparent background onto a drawing canvas, it does not support the transparency. It adds a background color. So that doesn't work either. But that is not really my current issue. What I want