Post Reply 
newRPL: Adding string processing commands?
09-21-2016, 04:32 PM
Post: #9
RE: newRPL: Adding string processing commands?
(09-21-2016 02:01 PM)Vtile Wrote:  
(09-21-2016 11:36 AM)emece67 Wrote:  A pair of functions split & rsplit working a la Python.

I suppose that including support for regular expressions is an overkill...

regular expressions?
Find / search is implemented in vanilla HP50g so I would assume that Claudio have planned something for it anyway?

I would personally propose "less is more" philosophy what comes to string manipulation and trying to make the commands more multiuse if possible. Only providing the basic building blocks which then allow building a libraries of broader string/text object utilities.

I'd say no regular expressions. They are almost impossible to understand by humans without a reference manual in hand, and would only make RPL even harder to read.

I just learned about split/rsplit. I think the proposed NTOKENS, NTHTOKEN and NTHTOKENPOS cover the same functionality without explicitly creating a list with all tokens. If such list was desired, it's not hard to implement in RPL:

"STR" "sep" SPLIT -> { "tok1" ... "tokN" }
can easily be implemented as:

'sep' LSTO 'str' LSTO
 str sep NTOKENS 'ntok' LSTO
1 ntok FOR K
str sep K NTHTOKEN
ntok ->LIST

Search is already given with POS, and we are proposing to complement it with RPOS, NPOS and NRPOS per post above.

In general, I agree on a small subset of powerful commands rather than a global do-it-all engine like regexp.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: newRPL: Adding string processing commands? - Claudio L. - 09-21-2016 04:32 PM

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