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

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

2010-10-20 Thread Nikita B. Zuev
;>                       left  'broken) >> >> -Paul >> >>> -Original Message- >>> From: users-boun...@racket-lang.org [mailto:users-boun...@racket-lang.org] >>> On Behalf Of Matthias Felleisen >>> Sent: Wednesday, October 20,

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

2010-10-20 Thread namekuseijin
On Wed, Oct 20, 2010 at 4:50 PM, 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 to get cumberso

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

2010-10-20 Thread Matthias Felleisen
sen >> Sent: Wednesday, October 20, 2010 2:30 PM >> To: Tony Garnock-Jones >> Cc: Nikita B. Zuev; users@racket-lang.org >> Subject: Re: [racket] Are there any functional structs in Racket >> >> >> >> I have a prototype that supports syntax

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

2010-10-20 Thread engineer
g] > On Behalf Of Matthias Felleisen > Sent: Wednesday, October 20, 2010 2:30 PM > To: Tony Garnock-Jones > Cc: Nikita B. Zuev; users@racket-lang.org > Subject: Re: [racket] Are there any functional structs in Racket > > > > I have a prototype that supports sy

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 thi

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) (pe

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 lan

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-a

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 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 the old

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

2010-10-20 Thread Tony Garnock-Jones
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) Tony _ For list-related administrative

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 wrote: > On 10/20/2010 09:05 AM, Stephen Bloch wrote: >> >> On Oct 20, 2010, at 3:16 AM, Nikita B. Zuev

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) (pr

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 be

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: http://lists.racket-lang.org/l

[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