[plt-scheme] typed scheme mutation & "style" question

From: keydana at gmx.de (keydana at gmx.de)
Date: Wed Apr 14 16:54:01 EDT 2010

Ah, of course, I see... in fact I started out with map because first I didn't think of using mutation at all, and then never questioned the choice...
Many thanks!



Am 14.04.2010 um 21:59 schrieb Noel Welsh:

> Perhaps you want for-each instead of map? Then your return type will
> be just Void.
> 
> HTH,
> N.
> 
> On Wed, Apr 14, 2010 at 8:40 PM, keydana at gmx.de <keydana at gmx.de> wrote:
>> Hi,
>> 
>> I have difficulties with using mutator code in typed scheme (in getting the typing right & "nice").
>> 
>> For example, I have a function
>> 
>> (: replace-attnames ((Listof (Pair Attribute String)) (Listof Attribute) -> (Listof (Listof Void))))
>> (define replace-attnames
>>  (lambda (renamings attrs)
>>    (map (lambda: ((mapping : (Pair Attribute String))) (map (lambda: ((a : Attribute)) (set-Attribute-name! a (cdr mapping))) (filter (lambda: ((att : Attribute)) (attribute=? att (car mapping))) attrs))) renamings)))
>> 
> ...
>> 
>> Many thanks in advance for your advice,
>> Sigrid_________________________________________________



Posted on the users mailing list.