Post Reply 
My wishes about NEW-RPL
09-30-2016, 12:22 PM
Post: #2
RE: My wishes about NEW-RPL
8: Please add the PART function, built-in the system, this function is essential in the handling of algebraic expression

thread
http://www.hpmuseum.org/forum/thread-637...light=part

Code:
« 0 0 { } -> EXPRESSION XPART NPARTS OPERATOR OBJECTS
  « EXPRESSION EVAL
    IFERR OBJ->
    THEN ->STR 'OPERATOR' STO 0 'NPARTS' STO OPERATOR 1 ->LIST 'OBJECTS' STO
    ELSE ->STR 'OPERATOR' STO 'NPARTS' STO NPARTS ->LIST 'OBJECTS' STO NPARTS OPERATOR OBJECTS 3 ->LIST DROP
      IF XPART NPARTS <= NOT
      THEN "EXPRESSION " EXPRESSION + " CONTAINS ONLY " + NPARTS + " PARTS" + KILL
      END
      IF XPART 0 ==
      THEN OPERATOR
      ELSE
        IF XPART -1 ==
        THEN NPARTS
        ELSE OBJECTS XPART GET
        END
      END
    END
  »
»
'PART' STO

'sin(x)+cos(x))' -1 → 2 // 2 parts
'sin(x)+cos(x)' 0 → "+" // operator
'sin(x)+cos(x)' 1 → 'sin(x)' // part1
'sin(x)+cos(x)' 2 → 'cos(x)' // part2
'sin(x)+cos(x)' 3 → "nonexistent part in the expression"
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
My wishes about NEW-RPL - compsystems - 09-30-2016, 03:16 AM
RE: My wishes about NEW-RPL - compsystems - 09-30-2016 12:22 PM
RE: My wishes about NEW-RPL - Claudio L. - 09-30-2016, 07:59 PM
RE: My wishes about NEW-RPL - compsystems - 09-30-2016, 08:45 PM
RE: My wishes about NEW-RPL - Claudio L. - 10-02-2016, 03:28 AM
RE: My wishes about NEW-RPL - compsystems - 10-01-2016, 02:02 PM
RE: My wishes about NEW-RPL - compsystems - 10-02-2016, 02:01 AM
RE: My wishes about NEW-RPL - compsystems - 10-01-2016, 02:11 PM
RE: My wishes about NEW-RPL - Claudio L. - 10-02-2016, 03:38 AM
RE: My wishes about NEW-RPL - compsystems - 10-03-2016, 01:42 PM
RE: My wishes about NEW-RPL - compsystems - 10-05-2016, 12:40 AM
RE: My wishes about NEW-RPL - compsystems - 10-22-2016, 09:04 PM



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