DB48X: HP48-like RPL implementation for DM42
|
07-18-2023, 08:06 AM
(This post was last modified: 07-18-2023 08:09 AM by c3d.)
Post: #30
|
|||
|
|||
RE: DB48X: HP48-like RPL implementation for DM42
(07-17-2023 11:41 PM)FLISZT Wrote: More precisely, I was thinking of backward compatibility... if possible.That was the way I read it. Quote:(07-17-2023 07:13 PM)c3d Wrote: For example, consider the `Dup` function. In DB48X, this can also be spelled `Duplicate`. There are preferences that let you display (and see it in the editor) as either `dup`, `DUP`, `Dup` or `Duplicate`. On input, you can spell it either way, as well as all case variants, e.g. `DUPLiCATE`. Good point. I opened an issue to remember that. However, note that the space of reserved keywords kept changing with each revision of RPL, so there is no real guarantee about which names you can use in your program across RPL implementations (only within one specific implementation). The rationale for accepting multiple spelling is because the usage model for the DM42 is in my opinion quite different from the traditional usage model on the HP48 due to the presence of a standard USB port and a disk mode. To me, this means that I must be able to accept programs typed on the calculator's keyboard (typically uppercase) as well as from a computer (where I DON'T WANT TO SHOUT ALL THE TIME :-). This is why the state file is in clear text, not in binary format like on the stock DM42 firmware. Quote:In my opinion << Duplicate >> isn't very useful because it's too long. But I do understand that this is just an example. This is exactly why there is a preference for that. I happen to like the long spelling. Not necessarily for DUP, which is common enough, but for functions like RNRM, RRK, RSBERR, SIDENS or TDELTA. If you can remember what they do without looking up the manual, congrats. I cannot, so I'd much rather have them display as RowNorm, RosenbrockErrorEstimate, RosenbrockRungeKuttaSolver, SiliconDensity and TemperatureDelta and save myself a trip to the manual. Hopefully, the built-in help will also make it easier to remember what these functions do and how to use them. Quote:It reminds me of WinDev (French Software Engineering Workshop) whose programming language can use English or French keywords. I don't know much more... Not sure I appreciate the comparison ;-) Quote:(07-17-2023 07:13 PM)c3d Wrote: << Lambdas are already a part of standard RPL. \lambdax(x+1) is written « → x 'x+1' » in RPL. You do not need to name that object. But again, lambdas are nothing but functions or programs without a name, which is exactly what RPL equations or program objects are. Your "Hello World" equivalent would be something like: Code:
Quote:(07-17-2023 07:13 PM)c3d Wrote: What could integrate well into RPL is an extension of the current local syntax to split lists into components. Something like « → { x y } « x x * y y * + » » would turn { 1 2 } into 5. The same could make sense for arrays as well, e.g. « → [ x y z ] 'sqrt(sq(x)+sq(y)+sq(z))' » would compute the norm of a 3-vector. This is the intent of the "rest" notation. This would allow you to recurse efficiently. Another thing I am considering is a "list processing" variant of `for`, e.g. Code:
would give you X+1+2+3+45 Quote:Otherwise, the difference with this It would be in terms of efficiency. A global storage like you L does not just pollute the user-visible variable space, it is very slow (relatively speaking) both in classical RPL and in db48x. Global variables are stored in one place which requires to (at least potentially) move many other objects when you change their values. By contrast, local variables use the same kind of fast temporary storage as the stack. Quote: But for an array... yes! This was exactly the idea of my proposed new construct. You would use a list to pass the data around, and extract fields with Code:
It might be useful to have something that builds a tagged list. For example Code:
(a clear plug for a fascinating book) would produce this list: Code:
I could even call it →Struct instead of →TaggedList. Quote:Another thing I'd thought of was the possibility of managing a (sequential) file… but there's no SD card reader in DM42 nor in DM32! But there is a local FAT filesystem which is easily accessible over USB. So file access make sense. I'm still thinking about how to expose that functionality. Today, the only feature that is implemented lets you save the calculator state to disk, and is mapped to double-shift EXIT. Quote:Last but not least, I'm sure there are possibilities in https://www.hpcalc.org/details/7971 that could inspire you, if they haven't already. Thanks for the insights. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)