Post Reply 
HHC 2016 RPL Programming Contest (HP-71B)
09-26-2016, 11:04 AM
Post: #3
RE: HHC 2016 RPL Programming Contest (HP-71B)
.
Hi, Jean-François:

(09-25-2016 08:11 AM)J-F Garnier Wrote:  As always, your HP-71B solutions are compact, efficient ... and amazing!

Thanks a lot for your kind comment, much appreciated, but it was far too easy a challenge so no great merit on my part.

Quote:For your 'nano-challenge' without string variable, may I suggest this way:

1 M=0 @ FOR I=1 TO LEN(DISP$) @ M=MAX(M,I-POS(DISP$,DISP$[I,I])) @ NEXT I @ DISP M

Correct. Your 'suggestion' is an exact copy (to the character) of the one I concocted. Of course I wouldn't expect any less of you ... 8-D
This technique (using DISP$) has at least 3 advantages over the S$ version:

1) No need to define or use a string variable to hold the input.

2) In use, you save one keystroke (only [RUN] instead of [RUN] and afterwards [ENTER]).

3) It allows for a much longer string as input. The S$ version limits input to 32 characters maximum, which is the default length of not explicitly dimensioned string variables, while the DISP$ version allows the user to input as many as 96 characters maximum, i.e., three times as many.

The DISP$ version is possible only because the HP-71B's BASIC implementation allows the substring operator [,] to work on any string expression, not just on string variables as was the case in simpler BASIC implementations such as the one for the HP-85, say.

Thanks for your interest in my 'micro-challenge' and for your perfect contribution.

Best regards.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2016 RPL Programming Contest (HP-71B) - Valentin Albillo - 09-26-2016 11:04 AM



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