HP Prime: MAKELIST in RPN mode?



#4

I'm trying to use MAKELIST in RPN mode but all I get are syntax errors. I've tried putting single quotes around the variable names, and around the entire function. Neither works

MAKELIST(A^2,A,1,10,1)
MAKELIST('A^2','A',1,10,1)
'MAKELIST(A^2,A,1,10,1)' This puts the MAKELIST function on the stack

Is there a way to do it?


#5

When you have functions that can accept multiple numbers of input, the only solution we were able to come up with was to specify the argument count. MAKELIST can accept either 4 or 5 arguments.

'A^2' 'A' 1 10 MAKELIST works, as does 'A^2' 'A' 1 10 MAKELIST(4) (those two are equivalent), or also 'A^2' 'A' 1 10 1 MAKELIST(5).

If a command does not automatically evaluate itself from the toolbox in RPN mode, this means that it has multiple argument counts that can be accepted and it needs further input on the number to take.

Something like MIN for example can take 1-16 arguments. That makes it very flexible, but means there is no way to use that in the "traditional" RPN style without disabling the flexibility.

TW

Edited: 13 Oct 2013, 6:52 p.m.


#6

One way to do this would be to provide the argument count as a suffix to the function name and create the appropriate closure when compiled.

Thus MAKELIST2('A',45) compiles 'behind the scenes' to MAKELIST(2,'A',45). Set an arbitrary maximum of 9 or 99 so that when the function is decompiled you know when to stop and use the long form.[*}

I've long wished for something like this in RPL for commands like DROPN where you rarely wish to drop a variable number of items from the stack and DROP7, say, would be more space efficient and easier to comprehend than 7 DROPN - especially if the 7 has to be put on the stack first and a whole bunch of rotates done before things line up.

[*] Although for the Prime, the source is retained so decompilation not an issue


Possibly Related Threads...
Thread Author Replies Views Last Post
  Integration question and "RPN" mode comment Craig Thomas 16 2,090 12-05-2013, 02:32 AM
Last Post: Nick_S
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 731 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  HP-Prime : Extracting elements from a list in RPN Miguel Toro 0 510 11-15-2013, 06:44 PM
Last Post: Miguel Toro
  HP Prime: Recommendation for future RPN Program Mode BruceTTT 3 617 11-13-2013, 10:03 PM
Last Post: BruceTTT
  [PRIME] RPN: another attempt at returning more than one value to the RPN stack Marcus von Cube, Germany 5 891 11-05-2013, 02:44 AM
Last Post: Marcus von Cube, Germany
  Program to change entry mode on Prime Michael de Estrada 3 616 10-28-2013, 10:13 AM
Last Post: Han
  PRIME Spreadsheet RPN Problem Dougggg 5 853 10-24-2013, 11:46 PM
Last Post: Han
  Prime: Exam mode (possible duplicate after funny response first time) Paul Townsend (UK) 1 460 10-24-2013, 03:09 PM
Last Post: Tim Wessman
  Does RPN entry mode cause the Prime keyboard to lock up ? Michael de Estrada 14 1,532 10-22-2013, 06:27 PM
Last Post: John Colvin
  HP Prime: Edit integer in RPN mode plivesey 15 1,523 10-18-2013, 04:34 PM
Last Post: kris223

Forum Jump: