Post Reply 
HP Prime. The programmer dream machine
09-19-2014, 05:05 PM
Post: #1
HP Prime. The programmer dream machine
Hi,

I did my first "serious" program on the Prime last week. It is a implementation of the game "2048". See the "HP Prime software library" forum if you want to try it.

I programmed this game directly on the calculator during my road trip to the U.S. (Not while I was driving!) I had no reference other that the online help. About 6 hours of work.

I can honestly declare that this is the best calculator I have ever programmed with. And I have tried a lot. The context sensitive help works very well, editor is good (if you don't swipe to scroll), copy paste also works very well. And the best aspect of it is the billions of functions to achieve want you want... And the speed...

Sure every time I do a RPN or RPL program, I feel a kind of pride at the end, especially when the implementation was clean and efficient. But programming a HP-50G is no where as easy as programming the prime.

I like very much this calculator. Sure it has some issues, but its advantages far outweigh its shortcomings. And for those who are wondering, I use it daily at work in RPN mode.

François
Find all posts by this user
Quote this message in a reply
09-19-2014, 07:25 PM
Post: #2
RE: HP Prime. The programmer dream machine
(09-19-2014 05:05 PM)Francois Lanciault Wrote:  But programming a HP-50G is no where as easy as programming the prime.

That is the only place where I disagree with you, and that is rooted in the fact that people are different.

I, for example, have never seen a Pascal-like language that can compete with the power and ease of use of a stack-based language such as RPL or FORTH.

Other than that, I agree 100% with the rest of your observations - the Prime is indeed an excellent programming environment for calculator programming.

Sigh ... if only the same hardware and help system were running RPL too. (The vastly expanded memory is the reason that so much programmer assistance can be provided with the base language.)
Find all posts by this user
Quote this message in a reply
09-19-2014, 08:01 PM
Post: #3
RE: HP Prime. The programmer dream machine
And programming in the virtual calculator and then move the program to the "real" one, is even more comfortable!
Find all posts by this user
Quote this message in a reply
09-19-2014, 08:32 PM
Post: #4
RE: HP Prime. The programmer dream machine
This looks like the right thread to add some of my encounters with the use of matrixes on Prime. If I have repeated info in other posts, please send me there.
First, the Prime's capabilities in this area are greatly understated in the documentation. I'm no whiz at math, but I work with matrixes as that is way that is common in my fields of interest. So, I tried the 'matrix, create random' with 10x10. Instantaneous. Then the inverse. Instantaneous. Step up the game: 50x50. In a second, the inverse; couple of seconds in RPN. Things slow down after 50 . . ..

But, this is a hand-held, not a Cray.

Now the fun part. Just playing around, I discovered that the Spreadsheet App (a clone of it) would store a matrix in a cell. A 50x50 matrix in a single cell (e.g. A2). Or many matrixes in many cells.

Then I found that if the 'Blue Bar' at the top of the Prime screen is associated with a spreadsheet, I could access the A2 matrix from the command line in CAS (or RPN, with different rules) and do things like A2*3 or A2*2->A3, etc.

Then I found that a program created in the Spreadsheet 'clone' would operate on the cells of the spreadsheet or the contents of a cell.

More to come . . ..
Visit this user's website Find all posts by this user
Quote this message in a reply
09-20-2014, 04:49 PM
Post: #5
RE: HP Prime. The programmer dream machine
(09-19-2014 05:05 PM)Francois Lanciault Wrote:  I programmed this game directly on the calculator during my road trip to the U.S. (Not while I was driving!) I had no reference other that the online help. About 6 hours of work.

I find the prime Basic is great, and would love programming it except I cant use the calculator for 6 hours doing programming with out it crashing and potentially loosing all my work. I just finished work on a program that took a 1.5-2 hours and all the sudden the editor was gone, the calculator frozen and I did a reset ok but the program editor wouldnt come up. I was lucky I did a 3 finger reset and the editor came back and program memory was intact. , but all my created apps are gone, luckily I had a backup.

So maybe there is secret to long period usage of the program editor with out the prime crashing
Find all posts by this user
Quote this message in a reply
09-21-2014, 01:53 AM
Post: #6
RE: HP Prime. The programmer dream machine
The secret to programming any device is to try not to program on the device, but use a development environment (IDE) and that is what the Connection Kit (CK) will do for you. Program on the Kit (and emulator) and test on the emulator. When your program runs without error, transfer it to your Prime.

Working with the emulator and CK using a PC keyboard (plus keystrokes from the emu) is MUCH easier that working on the Prime itself (unless you are very good at 'texting').

If you have to work on the Prime, exit from the program frequently to save your work.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-23-2014, 06:31 AM
Post: #7
RE: HP Prime. The programmer dream machine
Indeed the HP PPL language is powerful. I once made a Tunnel game that runs at 90 FPS and that was before I discovered about DIMGROB and BLIT usage. If the game runs at 90 FPS by redrawing everything on the screen every frame, imagine how fast would it be if I just scrolled around.

On top of that, you can even use sprites and polygons, something none of the TI/Casio BASIC languages can achieve. Granted, the TI-Nspire Lua language is more powerful now, but from what I saw in games, it still has a long way to go before its speed can compete with HP PPL speed.

-Dream of Omnimaga
https://dreamofomnimaga.page
Visit this user's website Find all posts by this user
Quote this message in a reply
09-01-2016, 04:52 AM
Post: #8
RE: HP Prime. The programmer dream machine
(09-19-2014 08:32 PM)dbbotkin Wrote:  Now the fun part. Just playing around, I discovered that the Spreadsheet App (a clone of it) [...]

Then I found that a program created in the Spreadsheet 'clone' [...]

Best regards. I'm new with my Prime. Where I can get this clone spreadsheet?, Tks.
Find all posts by this user
Quote this message in a reply
09-01-2016, 05:22 AM
Post: #9
RE: HP Prime. The programmer dream machine
Hello,

By spereadsheet clone, I assume he meant that he made a copy of the spreadsheet app.


Anyhow, thanks for the nice comments, on the programming language and online help!

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
09-01-2016, 12:54 PM
Post: #10
RE: HP Prime. The programmer dream machine
(09-19-2014 07:25 PM)Bill Zimmerly Wrote:  
(09-19-2014 05:05 PM)Francois Lanciault Wrote:  But programming a HP-50G is no where as easy as programming the prime.

That is the only place where I disagree with you, and that is rooted in the fact that people are different.

I, for example, have never seen a Pascal-like language that can compete with the power and ease of use of a stack-based language such as RPL or FORTH.

Other than that, I agree 100% with the rest of your observations - the Prime is indeed an excellent programming environment for calculator programming.

Sigh ... if only the same hardware and help system were running RPL too. (The vastly expanded memory is the reason that so much programmer assistance can be provided with the base language.)

I have been programming in procedural languages (FORTRAN, BASIC, COBOL, PL/I, etc.) since 1965. They match the way I think, step by step. I can write programs in RPL with a little difficulty but if I try to read them after a few weeks? Fuggedaboudit! HP Prime's language is just about perfect for me. Not only can I write programs easily, but I can look at old programs I've written and figure them out easily - even with sparse or no comments.

Chacun à son goût, as my grand-père used to say. I never knew what he was talking about!

Tom L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-01-2016, 04:04 PM (This post was last modified: 09-01-2016 04:13 PM by pgyore.)
Post: #11
RE: HP Prime. The programmer dream machine
Sorry, I have to chime in, and maybe it's already been discussed.

Prime would be my dream machine if it had Lua built in, instead of Pascal. I like Cyrille and Tim - I have met them both - but I wish I attended an HHC before the Prime was finalized and put Lua in their ear..

Admittedly, Lua is a lot like Pascal, but for some reason 'a := 1' really bugs me, compared to 'a = 1'.

I often ponder if Cyrille was born in Brazil, not France, we would have Lua on Prime ;)


Best regards,
PG
Find all posts by this user
Quote this message in a reply
09-01-2016, 04:29 PM
Post: #12
RE: HP Prime. The programmer dream machine
(09-01-2016 04:04 PM)pgyore Wrote:  I often ponder if Cyrille was born in Brazil, not France, we would have Lua on Prime Wink

The implication being?
Find all posts by this user
Quote this message in a reply
09-01-2016, 04:46 PM (This post was last modified: 09-01-2016 04:55 PM by Han.)
Post: #13
RE: HP Prime. The programmer dream machine
(09-01-2016 04:29 PM)Marcio Wrote:  
(09-01-2016 04:04 PM)pgyore Wrote:  I often ponder if Cyrille was born in Brazil, not France, we would have Lua on Prime Wink

The implication being?

The implication being it may have been more likely for them to have met sooner (e.g. HHC in Brazil as opposed to France or USA) for him to seed the idea of Lua on the Prime into Cyrille's head.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
09-01-2016, 04:53 PM
Post: #14
RE: HP Prime. The programmer dream machine
Actually, Lua originates in Brazil, Pascal in France.

That is what I meant.
Find all posts by this user
Quote this message in a reply
09-01-2016, 10:25 PM
Post: #15
RE: HP Prime. The programmer dream machine
(09-01-2016 04:53 PM)pgyore Wrote:  Actually, Lua originates in Brazil, Pascal in France.

That is what I meant.

No, Wikipedia says Pascal was developed by Niklaus Wirth, Switzerland.

Günter
Find all posts by this user
Quote this message in a reply
09-02-2016, 04:16 AM
Post: #16
RE: HP Prime. The programmer dream machine
Awesome! I stand corrected.

Best regards.
Find all posts by this user
Quote this message in a reply
09-02-2016, 09:14 AM
Post: #17
RE: HP Prime. The programmer dream machine
The Pascal programming language was developed by Dr Niklaus Wirth at the ETH in Zürich, Switzerland, in 1970. He named it after the French mathematician Blaise Pascal who produced the first mechanical adding machine in the early 17th century.
Wirth also designed Modula-2 and Oberon and became the Turing Prize in 1984.

So don't confuse Pascal's adding machine (France) with the Pascal programming language (Switzerland)
Find all posts by this user
Quote this message in a reply
09-04-2016, 08:28 AM
Post: #18
RE: HP Prime. The programmer dream machine
The Prime has much more CPU power and RAM than it takes to run implementations of real-world, higher-level programming languages such as Lua, Micro Python and Duktape.
The TI-Nspire officially supports a crippled form of the first one (basically no io.* and os.*, a platform-specific UI + keyboard layer), and unofficially the latter two.
Find all posts by this user
Quote this message in a reply
05-31-2021, 08:52 PM
Post: #19
RE: HP Prime. The programmer dream machine
My mind works in RPN/RPL. But I'll admit I can do the same thing on Prime with a lot less lines of code. I just had to remember how to use parentheses.
Find all posts by this user
Quote this message in a reply
Post Reply 




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