Discoverd interesting feature in HP-71B BASIC


Hello All,

I have been playing with the HP-71B computer by writing BASIC programs for various algorithms. I took a peek at the User's Library Math pac (on the museum DVD) to look at numerical integration methods. I noticed that the numerical integration program used the BASIC function VAL to evaluate expressions entered by the program users!! In typical BASIC interpreters, the VAL function merely converts a string constant or the contents of a string variable into numbers.

The HP-71B VAL function does much more! It interprets the string-type argument and evaluates it, like the HP-48/49/50 EVAL function!! This means that you can write programs that work with dynamic functions (ones that the user enters at run time) instead of functions hard-coded in the program itself.

I am curious if you were aware of this feature or not??? Am I the last person on earth to learn of the special interpreter ability of the VAl function?

Are there any other HP-71B BASIC functions on steroids (meaning they do more than the same functions on other BASIC interpreters)?


Edited: 21 Dec 2008, 10:06 a.m.


I was aware of it but I'm not sure I never used that particular one except in a spreadsheet program I didn't write. After using HP-71 BASIC for a couple of years, I had to use HP BASIC 5.1 on an HP-9000 series 68000-based computer and was very disappointed. HP-71 BASIC was far better in almost every way. It seemed the Colorado group could have stood to learn a few things from the Corvalis group and from the third parties that helped made HP-71 BASIC so outstanding.

Edited: 21 Dec 2008, 11:04 a.m.



Allowing the VAL function to tap into the underlying BASIC interpreter offers the programmers and users a lot of flexibility. Working with dynamic expressions enhances the HP-71B BASIC programs. For example you can use the VAL function with regression programs that can accept user-defined transformations for the data. Using this feature makes regression programs far more flexible.



Not to diminish the HP-71B, it's a great calculator/computer but there have been many implementations of BASIC that have EVAL-type functions, often called VAL. Even some of the simpler BASIC implementations include this, like the one in the Sinclair ZX-81.



... like the one in the Sinclair ZX-81.

Yes, but then the ZX-81 was a very special machine designed by a true genius. And several years before the HP-71B! I still have a chess program that fits inside the original 1kB RAM, together with just enough video memory (there was only one RAM chip in the ZX-81 used for everything!) to display the chessboard.

Greetings, Max


I never had, seen first hand, or used the Sinclair ZX-81. I do agree that it was deigned by one smart cookie!

On The PC, I used the CHAIN MERGE trick with GW-BASIC and BASICA. I would take the user's defined function, transform that input into BASIC statements, write these statements to a temporary file, and then apply the CHAIN MERGE statement. The original user's input becomes BASIC statements on the fly. No need to stop the program, edit lines,, and restart.



Also the Casio FX-850P/880P has a function called VALF that does the same trick.

These two and the 71B - all very fine machines!



I know the Casio 850/880 library of programs do accept user-defined functions. I was not aware of teh VALF function than can evaluate expressions in BASIC programs for these Casio machines.

Thanks! I can add these machines to my list.



Sharp PC-E500 (plastic thing with rubbery keys, pretty powerful, get one if you don't have it yet) - EVAL function is undocumented, but works really well both in the built-in software library (where I first stumbled upon it), and user programs.


The HP-71B Basic has also the possibility to use a variable as the target of GOTO, GOSUB and CALL statements for kind of indirect jump/call. Regular Basic had only the ON ... GOTO/GOSUB which was very limited.

With VAL, you can choose an expression to be evaluated at runtime; with this GOSUB/CALL feature, you can choose the name of a subroutine or subprogram to be executed.

Trivial example:

10 A$="KK"
20 X=2 @ CALL A$(X)
40 END
50 !
70 SUB KK(X)
80 X=X+2


Edited: 23 Dec 2008, 10:38 a.m.

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-80 History, Design and Interesting Facts BShoring 1 553 11-30-2013, 08:50 AM
Last Post: Xavier A. (Brazil)
  Prime feature request Stefan Dröge (Germany) 0 465 11-06-2013, 11:06 AM
Last Post: Stefan Dröge (Germany)
  Interesting Base Conversions - Porting a 1975 HP 25 Program to the HP 35S Eddie W. Shore 1 617 10-13-2013, 07:49 PM
Last Post: BruceH
  HP PRIME - Need help for basic program svp. dg1969 4 817 10-08-2013, 04:06 PM
Last Post: dg1969
  HP Prime "Notes" feature request Charles Bennett 0 419 09-27-2013, 12:14 PM
Last Post: Charles Bennett
  WP-34s feature suggestion: "Follow jump" shortcut Andrew Nikitin 3 719 06-12-2013, 01:42 AM
Last Post: Walter B
  Easter Sunday Basic Trigs (HP-12C) Gerson W. Barbosa 29 3,169 04-04-2013, 02:19 PM
Last Post: Gerson W. Barbosa
  [WP34s] Bug or feature? Dieter 25 2,550 01-03-2013, 06:20 PM
Last Post: Paul Dale
  "The Basic HP-71" Jeff Davis 3 725 08-30-2012, 12:20 AM
Last Post: Howard Owen
  Bug HP39GII....or feature? Bunuel66 14 1,583 08-11-2012, 02:59 PM
Last Post: Gilles Carpentier

Forum Jump: