Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
AW: [Caml-list] paralell assignment problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: AW: [Caml-list] paralell assignment problem
On Wed, 2005-02-09 at 01:24, Beck01, Wolfgang wrote:

> > I seek a solution which minimises the number of assignments. 
> you probably know the 'xor trick' to swap value without a temporary:

I've heard of it :)

> Certainly not what you were looking for, but always nice :-)

You are right, it isn't useful here for three reasons:

(1) the values being assigned aren't necessarily bitwise
  copyable, in fact they're (more or less) arbitrary C++ values

(2) The intent is to reduce time not storage

(3) The RHS can be arbitrary expressions. To apply XOR,
we'd first assign each RHS expression to a temporary ..
and having done that we no longer need XOR, we can just
assign variables to those temporaries.

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language