Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!samsung!spool.mu.edu!cs.umn.edu!uc!noc.MR.NET!gacvx2.gac.edu!hhdist From: TDSTRONG%MTUS5.BITNET@VM1.NoDak.EDU (Tim Strong) Newsgroups: comp.sys.handhelds Subject: RE: HP48 Vectors to Array? Message-ID: Date: 12 Mar 91 14:12:13 GMT Lines: 45 Return-path: <@VM1.NoDak.EDU:TDSTRONG@MTUS5.BITNET> In-reply-to: Your message of Mon, 11 Mar 1991 09:32 CST To: handhelds@gac.edu > >In a posting of [8 Mar 91 21:10:04 GMT] > ppetto@NCoast.ORG (Peter Petto) writes: > >>An HP-48SX question ... I would like to combine two vectors >>into an array as follows >> >> [ 2 4 6 8 ] plus [ 2 9 27 81 ] >> >> to get >> >> [[ 2 4 6 8 ] >> [ 3 9 27 81 ]] > >This is one of the more useful functions of \GS+ (\GS means the capital sigma) >how about? >\<< CL\GS SWAP \GS+ \GS+ RCL\GS \>> >It this short, or what? >There is one problem: it doesn't work with complex numbers. >Happy Hacking, How about CATARRY << OBJ-> 1 GET DROP 1 + ROLL OBJ-> 2 SWAP + ->ARRY >> Longer and not exactly elegant but it should work for complex arrays. It also has a deficiency in that it can't continue concatenating arrays to vectors. For example one's next step might be: [[ 2 4 6 8 ] [ 2 9 27 81 ]] [ 4 5 8 6 ] CATARRY hoping for [[ 2 4 6 8 ] [ 2 9 27 81 ] [ 4 5 8 6 ]] But it will probably give you a mess on the stack along with a two row array. I'm not sure my calculator ain't here so I can't check what happens but it will screw up. If I had my calculator I'm sure that with some work the above routine could be reworked to fix the problem.