Post Reply 
expanding list to objects
06-20-2016, 04:03 PM
Post: #9
RE: expanding list to objects
(06-16-2016 02:20 PM)poznavatelj Wrote:  I would like to expand list on stack, and then rearange elements by ROLL (up, down), and then again create list with rearanged elements. All in RPN modein HOME.
(06-19-2016 09:25 PM)Didier Lachieze Wrote:  @poznavatelj: I may be wrong but I don't think it's possible.

Well, I was wrong Wink here is a solution that will allow you do what you want but with some caveats (more keystrokes that you may expect and your starting list remaining on the stack).

The idea is based on the fact that in RPN mode when you enter several items separated by a Space on the command line and then press ENTER, each item goes to a different stack level. The way I’ve found to programmatically put an arbitrary string on the command line is to define a User key.

The following program is assigned in user mode to Shift 8 (which is the list key), it assumes that on the stack level 1 you have a list (if not it does nothing) and it puts on the command line the list elements separated by a space. You have to press ENTER to put them on the stack, each on a different level, then you can manipulate them as you want and put them back into a list with STACK ->LIST

Code:
KEY KS_8()
BEGIN
 LOCAL j,l,s:="";
 l:=Ans(1);
 IF TYPE(l)==6 THEN
  FOR j FROM 1 TO SIZE(l) DO
   s:=s+STRING(l(j))+" ";
  END; 
 END;
 RETURN s;
END;

Once you have entered your list on stack level 1 you have to press [Shift] [User] [Shift] [8] [ENTER], so 5 keystrokes for the equivalent of OBJ->
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
expanding list to objects - poznavatelj - 06-16-2016, 01:58 PM
RE: expanding list to objects - DrD - 06-16-2016, 02:16 PM
RE: expanding list to objects - retoa - 06-20-2016, 07:36 AM
RE: expanding list to objects - roadrunner - 06-20-2016, 11:08 AM
RE: expanding list to objects - Didier Lachieze - 06-20-2016 04:03 PM
RE: expanding list to objects - Stevetuc - 06-21-2016, 10:10 AM
RE: expanding list to objects - Joe Horn - 06-21-2016, 09:12 AM
RE: expanding list to objects - Wes Loewer - 06-21-2016, 09:13 AM
RE: expanding list to objects - Tonig00 - 06-19-2016, 07:05 PM



User(s) browsing this thread: 2 Guest(s)