caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] "changing" immutable record elements
@ 2004-05-14 15:50 David Fox
  2004-05-14 16:20 ` Martin Jambon
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: David Fox @ 2004-05-14 15:50 UTC (permalink / raw)
  To: Ocaml

Unless I am missing some core language feature, it seems to me that the 
most awkward part of the language is constructing an expression that 
represents a record with a single field modified:

let set_field3 rec value =
   match rec with
       {field1=field1; field2=field2; field3=field3; field4=field4; 
field5=field5} ->
          {field1=field1; field2=field2; field3=value; field4=field4; 
field5=field5}

is there any prettier way of doing this?


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-14 17:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 15:50 [Caml-list] "changing" immutable record elements David Fox
2004-05-14 16:20 ` Martin Jambon
2004-05-14 16:22 ` Virgile Prevosto
2004-05-14 17:02   ` Matt Gushee
2004-05-14 17:18     ` Virgile Prevosto
2004-05-14 16:28 ` Kenneth Knowles
2004-05-14 16:30 ` Andrew Lenharth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).