[BR_forum] Comparing arrays

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
GTISDALE at tisdalecpa...

[BR_forum] Comparing arrays

Post by GTISDALE at tisdalecpa... »

Is there a quick and efficient way to compare two arrays (assuming they are equally dimensioned) other than going line by line in a loop?
If not mat a$=b$
Does not seem to work
I can create a function of course, but looking for a good solution.
George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."

This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com) Thank you.

Post generated using Mail2Forum (http://www.mail2forum.com)
tech at sys-corp.com

[BR_forum] Comparing arrays

Post by tech at sys-corp.com »

If they are numeric, you can check the sum of the arrays with a single command, but that is not a true element by element comparison. So, I think no is the answer.

--Richard

George Tisdale wrote:
Comparing arrays
Is there a quick and efficient way to compare two arrays (assuming they are equally dimensioned) other than going line by line in a loop?
If not mat a$=b$
Does not seem to work
I can create a function of course, but looking for a good solution.
George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."

This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com (gtisdale@tisdalecpa.com)) Thank you.

_______________________________________________
BR_forum mailing list
BR_forum@maillist.ads.net (BR_forum@maillist.ads.net)
http://maillist.ads.net/mailman/listinfo/br_forum
Post generated using Mail2Forum (http://www.mail2forum.com)
GTISDALE at tisdalecpa...

[BR_forum] Comparing arrays

Post by GTISDALE at tisdalecpa... »

Attached can be PROCed into your copy of FNSNAP to compare arrays, including multi-dimensioned arrays.
I have not done extensive testing, but seems to work on the situations that I needed.
<<a>>
59800 DEF LIBRARY FNARRAYS(MAT ONE$,MAT TWO$) !:
! ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿!:
! ³ Compare two character arrays and returns false if they do ³!:
! ³ not match. Number of elements if they do. Handles multi ³!:
! ³ dimensioned arrays ³!:
! ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ!
59805 LET MULTI=_A=_B=0
59810 LET MULTI=UDIM(MAT ONE,2) ERROR 59815
59815 IF MULTI THEN LET _B=1
59820 DO WHILE _A<UDIM(ONE$)
59825 LET _A+=1
59830 IF NOT ONE$(_A)=TWO$(_A) THEN LET FNARRAYS=0 : GOTO ZARRAYS
59835 LOOP
59840 IF MULTI AND _B<MULTI THEN LET _B+=1 : LET _A=0 : GOTO 59820
59845 IF MULTI THEN LET FNARRAYS=_A*_B ELSE LET FNARRAYS=_A
59850 ZARRAYS: END DEF
59855 DEF LIBRARY FNARRAYSN(MAT ONE,MAT TWO) !:
! ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿!:
! ³ Compare two numeric arrays and returns false if they do ³!:
! ³ not match. Number of elements if they do. Handles multi ³!:
! ³ dimensioned arrays ³!:
! ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ!
59860 LET MULTI=_A=_B=0
59865 LET MULTI=UDIM(MAT ONE,2) ERROR 59870
59870 IF MULTI THEN LET _B=1
59875 DO WHILE _A<UDIM(ONE$)
59880 LET _A+=1
59885 IF NOT ONE(_A)=TWO(_A) THEN LET FNARRAYSN=0 : GOTO ZARRAYSN
59890 LOOP
59895 IF MULTI AND _B<MULTI THEN LET _B+=1 : LET _A=0 : GOTO 59875
59900 IF MULTI THEN LET FNARRAYSN=_A*_B ELSE LET FNARRAYSN=_A
59905 ZARRAYSN: END DEF
George L. Tisdale, CPA
Tisdale CPA
75 Junction Square Drive
Concord, MA 01742
(978) 369-5585
IRS Circular 230 Notice: "To ensure compliance with requirements imposed by the IRS, we inform you that any U.S. tax advice contained in this communication (including any attachments) is not intended or written to be used, and cannot be used, for the purpose of (i) avoiding penalties under the Internal Revenue Code or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein."

This electronic message transmission contains information which is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination or distribution of this communication to other than the intended recipient is strictly prohibited. If you have received this communication in error, please notify us immediately by calling (978) 369-5585 or by electronic mail (gtisdale@tisdalecpa.com) Thank you.

Post generated using Mail2Forum (http://www.mail2forum.com)
Post Reply