RE: Swap array values? In UV

2004-02-17 Thread Barry Brevik
 Within BASIC, try
 
 array(x)=BITXOR(array(x),array(y));
 array(y)=BITXOR(array(y),array(x));
 array(x)=BITXOR(array(x),array(y));

It only works with integers. Other real numbers and strings won't work.
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Re: Swap array values? In UV

2004-02-16 Thread FFT2001
In a message dated 2/13/2004 11:10:14 AM Pacific Standard Time, 
[EMAIL PROTECTED] writes:


 Within BASIC, try
 
 array(x)=BITXOR(array(x),array(y));
 array(y)=BITXOR(array(y),array(x));
 array(x)=BITXOR(array(x),array(y));
 
 No temp variable used.
 

ROFL.  Nice way to take a simple process and make it unintelligible.
You get the gold ribbon.
Will
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-16 Thread Brian Leach
It's an 'old as the hills' C programmers' trick

Which is no relection on Glenn of course ...

Brian 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: 16 February 2004 16:47
To: [EMAIL PROTECTED]
Subject: Re: Swap array values? In UV

In a message dated 2/13/2004 11:10:14 AM Pacific Standard Time,
[EMAIL PROTECTED] writes:


 Within BASIC, try
 
 array(x)=BITXOR(array(x),array(y));
 array(y)=BITXOR(array(y),array(x));
 array(x)=BITXOR(array(x),array(y));
 
 No temp variable used.
 

ROFL.  Nice way to take a simple process and make it unintelligible.
You get the gold ribbon.
Will
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


This email was checked by MessageLabs SkyScan before entering Microgen.



This email was checked on leaving Microgen for viruses, similar
malicious code and inappropriate content by MessageLabs SkyScan.

DISCLAIMER

This email and any attachments are confidential and may also be
privileged.

If you are not the named recipient, please notify the sender
immediately and do not disclose the contents to any other
person, use it for any purpose, or store or copy the information.

In the event of any technical difficulty with this email, please
contact the sender or [EMAIL PROTECTED]

Microgen Information Management Solutions
http://www.microgen.co.uk
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-13 Thread Dave Davis
I understand why this works, but honestly, that's nasty.

array(x)=BITXOR(array(x),array(y));
array(y)=BITXOR(array(y),array(x));
array(x)=BITXOR(array(x),array(y));

No temp variable used.

Our company accepts no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
Any views or opinions presented in this email are solely those of the 
author and do not necessarily represent those of the company.
WARNING: Computer viruses can be transmitted via email.
The recipient should check this email and any attachments for the 
presence of viruses. The company accepts no liability for any damage 
caused by any virus transmitted by this email.
11/29/2003 ACE Software, LLC

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-13 Thread Glenn Herbert
*lol*  i agree it's nasty and not readily obvious as to it's intent, but 
that wasn't the question posed...

sometimes it's just to exercise the mind

At 02:36 PM 02/13/2004, you wrote:
I understand why this works, but honestly, that's nasty.

array(x)=BITXOR(array(x),array(y));
array(y)=BITXOR(array(y),array(x));
array(x)=BITXOR(array(x),array(y));

No temp variable used.
Our company accepts no liability for the content of this email, or for the
consequences of any actions taken on the basis of the information
provided, unless that information is subsequently confirmed in writing.
Any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of the company.
WARNING: Computer viruses can be transmitted via email.
The recipient should check this email and any attachments for the
presence of viruses. The company accepts no liability for any damage
caused by any virus transmitted by this email.
11/29/2003 ACE Software, LLC
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-13 Thread Leroy Dreyfuss




UniVerse 10.0.x and higher have the SWAP command in BASIC. Please refer to
our documentation regarding its use.

-- original message --

Is there a command to swap two array contents?

Like matswap array(x,y)  will swap the contents of
array(x) - array(y)
and array(y) - array(x)

Without using a temp varible. Yes I know I can do it
that way.

Thanks
George

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[EMAIL PROTECTED]
ph:856.848.1000 Ext 220

SLACK Incorporated - An innovative information, education and management
company
http://www.slackinc.com

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Regards,

LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254  Fax: 303-294-4832
Mobile: 720-341-4317
External email:  [EMAIL PROTECTED]
WWW:  http://www.ibm.com/software/data/u2/support

www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-13 Thread George Gallen
Sorry Leroy,

but swap only swaps non array values,
and the mat portion will swap one array with another array

I want to swap two values inside an array.

I tried swap a(1),a(2) but it did nothing

tried.

dim a(10)
a(1)=5
a(2)=6
print a(1),a(2)
swap a(1),a(2)
print a(1),a(2)

and got:

5   6
5   6

but it did compile.

I tried swap mat a(1),mat a(2), that did not compile.



-Original Message-
From: Leroy Dreyfuss [mailto:[EMAIL PROTECTED]
Sent: Friday, February 13, 2004 5:18 PM
To: [EMAIL PROTECTED]
Subject: RE: Swap array values? In UV






UniVerse 10.0.x and higher have the SWAP command in BASIC. 
Please refer to
our documentation regarding its use.

-- original message --

Is there a command to swap two array contents?

Like matswap array(x,y)  will swap the contents of
array(x) - array(y)
and array(y) - array(x)

Without using a temp varible. Yes I know I can do it
that way.

Thanks
George

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[EMAIL PROTECTED]
ph:856.848.1000 Ext 220

SLACK Incorporated - An innovative information, education and 
management
company
http://www.slackinc.com

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Regards,

LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254  Fax: 303-294-4832
Mobile: 720-341-4317
External email:  [EMAIL PROTECTED]
WWW:  http://www.ibm.com/software/data/u2/support

www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-13 Thread Leroy Dreyfuss




I miss understood you. No, UV doesn't provide the facility to do that
within an array of any type- dynamic or dimensioned- that is not its
purpose. It will work if the arrays are different, such as:

DIM A(10),B(10)
MAT A = ''
MAT B = ''
A(1) = 678
B(1) = 234
CRT 'BEFORE:'
CRT 'A(1) = ':A(1), 'B(1) = ':B(1)
SWAP A(1),B(1)
CRT 'AFTER:'
CRT 'A(1) = ':A(1), 'B(1) = ':B(1)
C = ''
D = ''
C1 = 1234
C2 = 334
D1 = 5678
D2 = 778
CRT 'BEFORE:'
CRT 'C1 = ':C1, 'C2 = ':C2
CRT 'D1 = ':D1, 'D2 = ':D2
SWAP D, C
CRT 'AFTER:'
CRT 'C1 = ':C1, 'C2 = ':C2
CRT 'D1 = ':D1, 'D2 = ':D2

BEFORE:
A(1) = 678  B(1) = 234
AFTER:
A(1) = 234  B(1) = 678
BEFORE:
C1 = 1234 C2 = 334
D1 = 5678 D2 = 778
AFTER:
C1 = 5678 C2 = 778
D1 = 1234 D2 = 334

Since a variable can be considered a dynamic array with a only a single
attribute (our docs show a variable and not a dynamic array), I used a
dynamic array to illustrate the entire array gets swapped with another
array.

Regards,

LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254 Fax: 303-294-4832
Mobile: 720-341-4317
External email: [EMAIL PROTECTED]
WWW: http://www.ibm.com/software/data/u2/support

www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
George Gallen [EMAIL PROTECTED]

Sorry Leroy,

but swap only swaps non array values,
and the mat portion will swap one array with another array

I want to swap two values inside an array.

I tried swap a(1),a(2) but it did nothing

tried.

dim a(10)
a(1)=5
a(2)=6
print a(1),a(2)
swap a(1),a(2)
print a(1),a(2)

and got:

5   6
5   6

but it did compile.

I tried swap mat a(1),mat a(2), that did not compile.



-Original Message-
From: Leroy Dreyfuss [mailto:[EMAIL PROTECTED]
Sent: Friday, February 13, 2004 5:18 PM
To: [EMAIL PROTECTED]
Subject: RE: Swap array values? In UV






UniVerse 10.0.x and higher have the SWAP command in BASIC.
Please refer to
our documentation regarding its use.

-- original message --

Is there a command to swap two array contents?

Like matswap array(x,y)  will swap the contents of
array(x) - array(y)
and array(y) - array(x)

Without using a temp varible. Yes I know I can do it
that way.

Thanks
George

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[EMAIL PROTECTED]
ph:856.848.1000 Ext 220

SLACK Incorporated - An innovative information, education and
management
company
http://www.slackinc.com

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Regards,

LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254  Fax: 303-294-4832
Mobile: 720-341-4317
External email:  [EMAIL PROTECTED]
WWW:  http://www.ibm.com/software/data/u2/support

www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Regards,

LeRoy F. Dreyfuss
Advanced Technical Services - UniVerse
IBM U2 Data Management Solutions
Tel: 303-672-1254  Fax: 303-294-4832
Mobile: 720-341-4317
External email:  [EMAIL PROTECTED]
WWW:  http://www.ibm.com/software/data/u2/support

www.ibm.com/software/data/u2/support - Open, Query, Update, Search -
Online!
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


RE: Swap array values? In UV

2004-02-13 Thread Glenn W. Paschal
Ok, I love brainteasers, but to be honest, I don't see how this works,
possibly because I am one of those who has never used BITXOR, and so don't
readily understand it.  Please elaborate!

Thanks, --Glenn.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Glenn Herbert
Sent: Friday, February 13, 2004 2:25 PM
To: U2 Users Discussion List
Subject: RE: Swap array values? In UV


*lol*  i agree it's nasty and not readily obvious as to it's intent, but 
that wasn't the question posed...

sometimes it's just to exercise the mind

At 02:36 PM 02/13/2004, you wrote:
I understand why this works, but honestly, that's nasty.

 array(x)=BITXOR(array(x),array(y));
 array(y)=BITXOR(array(y),array(x));
 array(x)=BITXOR(array(x),array(y));
 
 No temp variable used.



-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Re: Swap array values? In UV

2004-02-13 Thread Results
Glen,
   XOR means Exlusive OR. Example:
   00110 BITXOR 10011 yields 10101

   because 0 XOR 1 = 1, 0 XOR 0 = 0, 1 XOR 0 = 1, (here's the tricky 
one) 1 XOR 1 = 0 (because it needs to be exclusive), and 0 XOR 1 = 1
   10   
 1  
0   
1

   The example is still hard to read, even when you understand XOR, 
because it is a counter-intuitive approach. It is, however, 
frighteningly clever.

   - Charles 'Exclusive' Barouch

Glenn W. Paschal wrote:

Ok, I love brainteasers, but to be honest, I don't see how this works,
possibly because I am one of those who has never used BITXOR, and so don't
readily understand it.  Please elaborate!
Thanks, --Glenn.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Glenn Herbert
Sent: Friday, February 13, 2004 2:25 PM
To: U2 Users Discussion List
Subject: RE: Swap array values? In UV
*lol*  i agree it's nasty and not readily obvious as to it's intent, but 
that wasn't the question posed...

sometimes it's just to exercise the mind

At 02:36 PM 02/13/2004, you wrote:
 

I understand why this works, but honestly, that's nasty.

   

array(x)=BITXOR(array(x),array(y));
array(y)=BITXOR(array(y),array(x));
array(x)=BITXOR(array(x),array(y));
No temp variable used.
 



 

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users