Browse thread
[Caml-list] "changing" immutable record elements
-
David Fox
- Martin Jambon
- Virgile Prevosto
- Kenneth Knowles
- Andrew Lenharth
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Andrew Lenharth <alenhart@c...> |
| Subject: | Re: [Caml-list] "changing" immutable record elements |
let set_field3 r value = {r with field3=falue}
Have fun
Andrew Lenharth
On Fri, May 14, 2004 at 08:50:32AM -0700, David Fox wrote:
> 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
--
"It will work in practice, yes. But will it work in theory?"
--- a french diplomat's comment, recalled by Madeleine Albright
-------------------
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