[racket] Are there any functional structs in Racket

2010-10-20 Thread Nikita B. Zuev
Hello, I'm looking for a way to use Raket's structs in a functional way. Example: (define-struct person (name age)) (define p (make-person Nikita 25)) ;; in documentation I found only setters, that mutate struct: (person-set-age! p 26) ;; to make functional update I have to write (define p1

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

2010-10-20 Thread Jakub Piotr Cłapa
On 20.10.10 09:16, Nikita B. Zuev wrote: Hello, I'm looking for a way to use Raket's structs in a functional way. Have you tried struct-copy ? -- regards, Jakub Piotr Cłapa _ For list-related administrative tasks:

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

2010-10-20 Thread Stephen Bloch
On Oct 20, 2010, at 3:16 AM, Nikita B. Zuev wrote: I'm looking for a way to use Raket's structs in a functional way. Example: (define-struct person (name age)) ... (define (person-age-set p proc) (make-person (person-name p) (proc (person-age p Matthias has been

Re: [racket] Servlets and forms

2010-10-20 Thread Jay McCarthy
I will push this change shortly. Jay On Tue, Oct 19, 2010 at 7:19 PM, Nadeem Abdul Hamid nad...@acm.org wrote: On Sat, Oct 9, 2010 at 6:12 PM, Jay McCarthy jay.mccar...@gmail.com wrote: The next release has support for almost all the form elements:

[racket] Emacs-style keybindings in Windows

2010-10-20 Thread Joe Snikeris
Hi all, I find the default emacs-style keybindings difficult to cope with in Windows. Specifically, I'm used to Alt filling in for Meta in emacs. I've been a good sport in trying to get used to this new editing environment. but reaching up to ESC and pressing 'w' is too awkward for something

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

2010-10-20 Thread Everett Morse
On 10/20/2010 09:05 AM, Stephen Bloch wrote: On Oct 20, 2010, at 3:16 AM, Nikita B. Zuev wrote: I'm looking for a way to use Raket's structs in a functional way. Example: (define-struct person (name age)) ... (define (person-age-set p proc) (make-person (person-name p)

Re: [racket] reading a file in student languages

2010-10-20 Thread Eli Barzilay
Yesterday, Adam Shaw wrote: Hi -- Could someone tell me how to read in a data file in Int. Student or Adv. Student? I'd like something like (define dict (read /path/to/dict)) and bind dict to a list of strings. This works: (with-input-from-file /path/to/dict read) but you're

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

2010-10-20 Thread Shriram Krishnamurthi
It's not in the student languages, and I'm not sure I like the name from a teaching perspective (copy is too much of an implementation issue). On Wed, Oct 20, 2010 at 12:58 PM, Everett Morse we...@unoc.net wrote: On 10/20/2010 09:05 AM, Stephen Bloch wrote: On Oct 20, 2010, at 3:16 AM, Nikita

Re: [racket] Emacs-style keybindings in Windows

2010-10-20 Thread Joe Snikeris
On Wed, Oct 20, 2010 at 12:11 PM, Joe Snikeris j...@snikeris.com wrote: I find the default emacs-style keybindings difficult to cope with in Windows. Somewhat related: I'm editing a file and press C-s to search for something. I press C-o to switch to the search frame. I enter my search text.

Re: [racket] Emacs-style keybindings in Windows

2010-10-20 Thread Shriram Krishnamurthi
I turn off menu key bindings: Edit | Preferences... | Editing | General | Enable keybindings in menus (turn it off). Now you have Alt at your disposal, and with it a good chunk of Emacs keybindings. I edit all my code in DrRacket on Windows, and with this configuration, it works very well.

Re: [racket] Emacs-style keybindings in Windows

2010-10-20 Thread Joe Snikeris
On Wed, Oct 20, 2010 at 1:54 PM, Shriram Krishnamurthi s...@cs.brown.edu wrote: I turn off menu key bindings: Me too. (turn it off).  Now you have Alt at your disposal, and with it a good chunk of Emacs keybindings. What do you press to copy selected text? I edit all my code in DrRacket

Re: [racket] Emacs-style keybindings in Windows

2010-10-20 Thread Shriram Krishnamurthi
I turn off menu key bindings: Me too. So what's the problem w/ using Alt? (turn it off).  Now you have Alt at your disposal, and with it a good chunk of Emacs keybindings. What do you press to copy selected text? C-Space to start selecting, M-w (Alt+w) to copy, and C-y to paste. It is

Re: [racket] Emacs-style keybindings in Windows

2010-10-20 Thread Joe Snikeris
On Wed, Oct 20, 2010 at 2:04 PM, Shriram Krishnamurthi s...@cs.brown.edu wrote: (turn it off).   Now you have Alt at your disposal, and with it a good chunk of Emacs keybindings. What do you press to copy selected text? C-Space to start selecting, M-w (Alt+w) to copy, and C-y to paste. Ahh

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

2010-10-20 Thread Shriram Krishnamurthi
That's good! Danny and I have been using update-person-age for this. On Wed, Oct 20, 2010 at 2:21 PM, Tony Garnock-Jones to...@ccs.neu.edu wrote: Stephen Bloch wrote: person-age-set set-person-age (without the !) person-with-age I like this last one, especially if it were possible to use

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

2010-10-20 Thread Neil Van Dyke
Tony Garnock-Jones wrote at 10/20/2010 02:21 PM: Stephen Bloch wrote: person-age-set set-person-age (without the !) person-with-age I like this last one, especially if it were possible to use the old abbreviation of / for -with-: (person/age p 25) I've used things like person-with-age

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

2010-10-20 Thread Matthias Felleisen
I have a prototype that supports syntax like this one: (dot a-world ufo wings left) which would select the left field of a wings field in a ufo field of a world struct. Similarly, (set a-world ufo wings left 'broken) would be a functional update. I intend to add it into the 2htdp

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

2010-10-20 Thread Tony Garnock-Jones
Neil Van Dyke wrote: The only reason I'm not 100% thrilled by abbreviating it as person/age is that that identifier is just a punctuation character rotated 45 degrees away from the getter, person-age. That (quasisymmetry) was one of the things I liked about it :-) (person-age p)

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

2010-10-20 Thread Neil Van Dyke
Tony Garnock-Jones wrote at 10/20/2010 02:35 PM: Neil Van Dyke wrote: The only reason I'm not 100% thrilled by abbreviating it as person/age is that that identifier is just a punctuation character rotated 45 degrees away from the getter, person-age. That (quasisymmetry) was one of the things

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

2010-10-20 Thread engineer
Are you all also considering some way to conveniently update more than one at a time? Functional style is still much more cumbersome than mutation style. (set (set a-world ufo wings right 'damaged) ufo wings left 'broken) starts to get cumbersome quickly. Is something like the below possible?

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

2010-10-20 Thread Matthias Felleisen
Should be doable: (set a-world ufo wings [right 'damaged] [left 'broken]) is the most likely syntax I anticipate. On Oct 20, 2010, at 2:50 PM, engin...@alum.mit.edu wrote: Are you all also considering some way to conveniently update more than one at a time? Functional style is still

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

2010-10-20 Thread namekuseijin
On Wed, Oct 20, 2010 at 4:50 PM, engin...@alum.mit.edu wrote: Are you all also considering some way to conveniently update more than one at a time?  Functional style is still much more cumbersome than mutation style. (set (set a-world ufo wings right 'damaged) ufo wings left 'broken) starts

[racket] a simple? regexp-match/replace

2010-10-20 Thread scouic
Hi all, i'm reading the documentation on cookies (net/cookie), and i try to save with a cookie an user action in my blog. For example, the cookie my-cookie has this content : id=blabla; Version=1 OR this one : id=bla bla; Version=1 How can i just extract the string bla bla or blabla ? thanks,

Re: [racket] Transparent area's

2010-10-20 Thread Noel Welsh
Hi, My recollection is that the current graphics toolkit has limited support for transparency, but it should work for drawing text on an image. Can you send a small example illustrating the problem? Cheers, N. On Mon, Oct 18, 2010 at 2:07 PM, Christophe Vandenberghe chv...@gmail.com wrote: I

Re: [racket] a simple? regexp-match/replace

2010-10-20 Thread Noel Welsh
Look up this library: web-server/http/cookie-parse It has the functions to do what you want. N. On Wed, Oct 20, 2010 at 9:31 PM, scouic sco...@gmail.com wrote: Hi all, i'm reading the documentation on cookies (net/cookie), and i try to save with a cookie an user action in my blog. For

Re: [racket] HtDP-style sound exercises

2010-10-20 Thread Noel Welsh
Looks fun. On Mon, Oct 18, 2010 at 8:56 PM, John Clements cleme...@brinckerhoff.org wrote: The challenge is how to deal with generating sounds: do you use vectors, explicit for, or HOF? If the latter, do you use lambda or local? IIUC, HOFs are the simplest way to do this. You want a function

Re: [racket] a simple? regexp-match/replace

2010-10-20 Thread scouic
Hey noel, thank you, it works perfectly. However, i have the following problem : i can't modify my cookie-value ... my blog starts with (define start request) ( my-home-page request)) next, (define (my-home-page request) (define foo (make-cookie id my-content) (set! foo (set-cookie id

Re: [racket] [off-topic] iPhone

2010-10-20 Thread Eli Barzilay
On June 18th, Raffael Cavallaro wrote: On Jun 18, 2010, at 1:41 PM, John Clements wrote: I think it's a good idea to be aware that the ability to compile and run arbitrary programs on the computers sold to us by Apple (or any other company) is not a constitutionally protected right,

Re: [racket] a simple? regexp-match/replace

2010-10-20 Thread Noel Welsh
On Wed, Oct 20, 2010 at 10:03 PM, scouic sco...@gmail.com wrote: I don't understand : i start my blog wich calls (my-home-page), and this one creates a cookie. But in (a-post request) i can't i modify my cookie, because foo is an unknown word ... How can i retrieve the content of my cookie in

Re: [racket] reading a file in student languages

2010-10-20 Thread Adam Shaw
Yes! That's what I need more. Thanks for the quick response. - Adam On Oct 19, 2010, at 4:14 PM, Matthias Felleisen wrote: Is 2htdp/batch-io as documented something you might find useful? On Oct 19, 2010, at 3:58 PM, Adam Shaw wrote: Hi -- Could someone tell me how to read in a

Re: [racket] Using lex and yacc

2010-10-20 Thread Paulo J. Matos
Also try: http://www.codaset.com/pmatos/eboc/source/master/blob/eventb-parser.rkt It's a parser for the formal language Event-B. Cheers, PMatos Eduardo Bellani ebell...@gmail.com writes: I've just completed a small example for a logo like language using the parser tools. Take a look at

Re: [racket] garbage collection and process idling

2010-10-20 Thread Noel Welsh
Yes. This is something I think would be an interesting research project, along with a generalisation of weak refs. It's fairly simple to frame as a reinforcement learning problem. This is some work on this, but I think tech. has moved on in important ways since. N. On Sun, Oct 17, 2010 at 12:04

[racket] reliable path comparison?

2010-10-20 Thread Danny Yoo
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 the right way to compare paths for equality? As a related

Re: [racket] reliable path comparison?

2010-10-20 Thread Eli Barzilay
Four minutes ago, 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 the right way to compare

Re: [racket] reliable path comparison?

2010-10-20 Thread Danny Yoo
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 the right way to compare paths for equality? IIRC, there

Re: [racket] reliable path comparison?

2010-10-20 Thread synx
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/20/2010 08:38 PM, Danny Yoo wrote: Yikes. Ok, is there a way to tell if a filesystem root is case-sensitive or not? Use a POSIX compatible operating system. Bam, your filesystem root is case-sensitive. -BEGIN PGP SIGNATURE- Version:

Re: [racket] Emacs-style keybindings in Windows

2010-10-20 Thread Eric Hanchrow
On Wed, Oct 20, 2010 at 10:54 AM, Shriram Krishnamurthi s...@cs.brown.edu wrote: I turn off menu key bindings: Edit | Preferences... | Editing | General | Enable keybindings in menus Aha! I think I used to know that ... ... while we're on the subject, I see that M-( does in DrRacket what it

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

2010-10-20 Thread Nikita B. Zuev
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 p.s. About names `person/age' vs `person-with-age', maybe `person-age'

Re: [racket] reliable path comparison?

2010-10-20 Thread YC
On Wed, Oct 20, 2010 at 8:38 PM, Danny Yoo d...@cs.wpi.edu wrote: IIRC, there was no right way -- I think that on windows you can have some drives be case-sensitive and some are not. Yikes. Ok, is there a way to tell if a filesystem root is case-sensitive or not? I am not aware of