[racket] Are there any functional structs in Racket

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Oct 20 14:52:54 EDT 2010

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, <engineer at 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 to get cumbersome quickly.
> 
> Is something like the below possible?  Is it scalable/manageable?  Maybe it
> needs more grouping symbols like a cond clause.
> 
> (set a-world ufo wings right 'damaged
>                       left  'broken)
> 
> -Paul
> 
>> -----Original Message-----
>> From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
>> On Behalf Of Matthias Felleisen
>> Sent: Wednesday, October 20, 2010 2:30 PM
>> To: Tony Garnock-Jones
>> Cc: Nikita B. Zuev; users at racket-lang.org
>> Subject: Re: [racket] Are there any functional structs in Racket
>> 
>> 
>> 
>> 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 languages.
>> 
>> 
>> 
>> 
>> 
>> On 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
>> abbreviation of "/" for "-with-":
>>> 
>>> (person/age p 25)
>>> 
>>> Tony
>>> 
>>> _________________________________________________
>>> For list-related administrative tasks:
>>> http://lists.racket-lang.org/listinfo/users
>> 
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.