This was in my mail right next to Arc..... I thought it was current. Sorry
Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Linda Alvord Sent: Tuesday, November 06, 2012 4:07 AM To: 'Programming forum' Subject: Re: [Jprogramming] Appending two numbers to form a new number 500+".(":12),":345 12845 Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of PackRat Sent: Thursday, July 14, 2011 11:50 PM To: Programming forum Subject: [Jprogramming] Appending two numbers to form a new number I wish to append the digits of two numbers to form a new number: 12 345 --> 12345 I'm sure this is elementary, but I'm currently stumped. Here's some data (which in reality would have been read in from a CSV file and then transposed): aa=. 2 7 $ 6;30;1;17;119;118;116;63;2;5;17;103;14;1 +--+--+-+--+---+---+---+ |6 |30|1|17|119|118|116| +--+--+-+--+---+---+---+ |63|2 |5|17|103|14 |1 | +--+--+-+--+---+---+---+ Then I pulled out the numeric data pairs, converted them to literals, and appended them: b=. ( ": every 0{aa ) ,. ( ": every 1{aa ) 6 63 30 2 1 5 17 17 119103 11814 1161 Just for visual purposes here (NOT in J!), I substituted * for spaces, to show what's happening: 6**63* 30*2** 1**5** 17*17* 119103 11814* 1161** However, what I want to end up with is this, no spaces, different lengths: 663 302 15 1717 119103 11814 1161 To attempt to do this, I did the following: spc=. ' ' E. every b 0 1 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 keepmask=. (0 = spc) 1 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 I thought that the following would accomplish what I wanted, but it does NOT: nospc=. keepmask # each b +-+-+-+-+-+-+ |6| | |6|3| | +-+-+-+-+-+-+ |3|0| |2| | | +-+-+-+-+-+-+ |1| | |5| | | +-+-+-+-+-+-+ |1|7| |1|7| | +-+-+-+-+-+-+ |1|1|9|1|0|3| +-+-+-+-+-+-+ |1|1|8|1|4| | +-+-+-+-+-+-+ |1|1|6|1| | | +-+-+-+-+-+-+ Essentially, this puts me right back where I started, without accomplishing anything. I thought it would be a very straightforward process to append the digits of two numbers--it's sort of the reverse of what was discussed here recently. The final step, of course, is to convert the new literal back into a number (but that part's easy!). I appreciate any help with this--thanks in advance! Harvey ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
