* Syntax for partial copy of struct member
@ 2006-06-11 4:35 Erik de Castro Lopo
2006-06-11 4:46 ` Erik de Castro Lopo
0 siblings, 1 reply; 2+ messages in thread
From: Erik de Castro Lopo @ 2006-06-11 4:35 UTC (permalink / raw)
To: caml-list
Hi all,
There's something in Ocaml that allows me to have a struct
defined as:
type struct_t = { a : int ; b : int ; c : int }
and an instance of that say:
let x = { a = 1 ; b = 2 ; c = 3 }
and then have:
let y = { a = 2 ; (* b and c filled in from x *) }
but I can't for the life of me remember the syntax. Anyone care
to give me a gentle tap with the clue bat?
Thanks,
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
"Death is perhaps too easy" -- Iqbal Sacranie in 1989 about
Salman Rushdie, author of "The Satanic Verses". Sacranie
received a knighthood in 2005 as the face of 'moderate'
British Islam. He has never disowned his earlier statement.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Syntax for partial copy of struct member
2006-06-11 4:35 Syntax for partial copy of struct member Erik de Castro Lopo
@ 2006-06-11 4:46 ` Erik de Castro Lopo
0 siblings, 0 replies; 2+ messages in thread
From: Erik de Castro Lopo @ 2006-06-11 4:46 UTC (permalink / raw)
To: caml-list
Erik de Castro Lopo wrote:
> let y = { a = 2 ; (* b and c filled in from x *) }
>
> but I can't for the life of me remember the syntax.
And as soon as I post to the list, I suddenly remember:
let y = { x with a = 2 }
Sorry for distrubing everyones weekend.
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
"There is only a small difference between a strong atheist and
a Christian: they agree on a very long list of gods that don't
exist, and disagree about only one of them."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-11 4:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-11 4:35 Syntax for partial copy of struct member Erik de Castro Lopo
2006-06-11 4:46 ` Erik de Castro Lopo
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).