Author Topic: Is 1▶a instead of a := 1 bad practice? (HP Prime)  (Read 8782 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Is 1▶a instead of a := 1 bad practice? (HP Prime)
« on: January 07, 2014, 07:18:08 pm »
I was wondering this for a while, because I think I am one of the only two HP Prime coders to ever have used the STO symbol ▶ in HP PPL programming. Everyone else uses the := syntax, which is closer to computer languages.

However, I was wondering if it was considered a bad practice in HP programming to use the STO symbol to store variables instead of the var := value syntax or if it was considered as fine? To be honest, I prefer the STO syntax because I have used TI-83 Plus BASIC for over 12 years, as well as Axe and to a lesser extent Casio BASIC, which all uses the STO syntax, so I am very used to it. Also, using STO makes it much easier for me to port old TI programs, not to mention the = symbol is much harder to access than STO on the HP Prime keypad.

I was wondering what is everyone thoughts about this?

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #1 on: January 07, 2014, 07:50:28 pm »
Whichever is slower or bigger is bad practice.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Han

  • LV3 Member (Next: 100)
  • ***
  • Posts: 62
  • Rating: +7/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #2 on: January 07, 2014, 09:09:20 pm »
I am pretty sure the ▶ symbol was implemented to help the TI folks transition to the HP Prime. The := syntax was implemented (again I am guessing) so that it would be easy to program on a PC and transfer to the calculator. So if you program on the calculator, either is fine. They even use the same keystrokes (if you have alpha locked for the := notation). On a PC, it would be very impractical to use ▶ unless you have a special setup.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #3 on: January 07, 2014, 09:25:59 pm »
They even use the same keystrokes (if you have alpha locked for the := notation).
I am confused, because I can't see := as a whole on the HP Prime keypad (although I can see = selectable in a menu). ???


And I see, I guess that might explain it. I personally don't mind using :=, but I feel more comfortable with STO except when using the Connectivity Kit.

Offline Han

  • LV3 Member (Next: 100)
  • ***
  • Posts: 62
  • Rating: +7/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #4 on: January 07, 2014, 09:33:11 pm »
I mean number of keystrokes. [Shift][EEX] vs [-][.] if you already have alpha-lower-case-shift locked (press [Alpha][Alpha][Shift][Alpha])

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #5 on: January 07, 2014, 10:01:57 pm »
Oh right I see now. It's kinda weird since it shows :. if lowercase isn't on. Thanks ;D

Offline TomL_12953

  • LV0 Newcomer (Next: 5)
  • Posts: 3
  • Rating: +0/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #6 on: January 08, 2014, 04:58:11 am »
However, I was wondering if it was considered a bad practice in HP programming to use the STO symbol to store variables instead of the var := value syntax or if it was considered as fine?
I was wondering what is everyone thoughts about this?

I use the := since it's closer to other languages and it can be saved to a text file with no special fonts. The STO symbol doesn't always work well in text files. (Neither do the square root symbol, the less than or equal to symbol, etc.)

Tom L

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #7 on: January 08, 2014, 12:40:28 pm »
I don't know if there is good or bad practice about STO or :=, only the guys who wrote the PPL compiler could answer that I guess. I tend to use := for same reasons as TomL above, because well, it is how it has always worked on computer ^^ I don't know why calculators BASICs always have so weird syntax.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #8 on: January 08, 2014, 01:39:28 pm »
I think the STO command is because older scientific calculators from various companies (such as sharp and Casio) worked with it when storing to one of the available memories, so when TI made graphing calcs, they wanted to keep it similar, same for Casio, but then HP released the Prime so they probably decided to offer both syntax in case.

In my case I am not very used to := since the last time I programmed for the computer was in 2003.

That said, I guess the conclusion is that both are fine as long as they take the same amount of memory and speed to execute, and that just the STO syntax might be slightly harder to read by the HP programmer majority.

Welcome on the forums by the way TomL_12953 :D
« Last Edit: January 08, 2014, 01:39:48 pm by DJ Omnimaga »

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #9 on: January 08, 2014, 01:56:09 pm »
I know, the last time I programmed using calculator BASIC (excluding RPL, wich was even more cryptic, but for good reasons, and now PPL) was in 94 or so, on the Casio FX8500G (the last of the first gen of graphing calc). This didn't make more sense even then, every computer BASICs already had VAR = xxx syntax for years. My guess is that it was an attempt to make a programming language for non-programmer people, which sounds like a strange idea to me.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #10 on: January 08, 2014, 02:03:11 pm »
Yeah the TI-83 Plus has a third-party RPL language called FastRPL and many people including myself didn't use it because we found it too cryptic and confusing (it seemed like we needed Z80 ASM knowledge in order to use it), but I heard it gave much more freedom to the programmer.

I'm thinking that the calculator languages were often designed so that the user can enter code the same way he enters equations on a scientific calculator, but allow him to execute them in one click, rather than offering a programming language similar to computer ones.

That said, it didn't stop people from getting interested into computer programming by using their experience from calculator programming. :D

Offline MacBernick

  • LV3 Member (Next: 100)
  • ***
  • Posts: 93
  • Rating: +3/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #11 on: January 08, 2014, 02:27:54 pm »
RPL looks weird when not used to it because it is stack based. Instead of having the traditional function(args) syntax, you push args on the stack, then call the function (not to be mingled with the Z80 stack which is a different thing, I can't remember using any assembly knowledge to do RPL programs but.. maybe). I think It made sense on HP4x series because the whole OS was stack based, thus parsing it is straightforward. Funny thing there's a TI version out there, I'll try it one day.

Anyway, we have choice now to use the syntax we want, this is a good thing :)

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #12 on: January 08, 2014, 11:40:16 pm »
RPL feels reminiscent of lambda calc for me, which is nice. :) One thing I can't wait for on the Prime is RPN programming and the anonymous « PROG » (or now « prog » if you want, thank goodness) that I grew to love on the 28S and the simplicity of programs as evaluated vars. Once you get used to it, or use the « → [var...] » syntax (really like lambda there), it's awesome for development as it is really quick to prototype. (Related: is anyone else getting problems where sin(2π)=-2.0676...e-13? It's annoying. I don't want to have to do a CAS simplify for my trig functions.)

With the  ▶, I treat it like I have on the Nspire; I avoid it and use := because of code readability on long lines. The code's compiled in programs, so it is speed-wise the same either way you choose. I also second Han's comment on keystrokes, if you program in non-shouty mode it's just (-)(.) (which are (:) (=) in lowercase).
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline timwessman

  • LV3 Member (Next: 100)
  • ***
  • Posts: 94
  • Rating: +32/-0
    • View Profile
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #13 on: January 16, 2014, 10:51:27 am »
There is no difference internally between the two STO commands. They just allow you to do stuff in a slightly different way if preferred. The STO> operator is nice to store into variables during calculations though since very often you don't realize you want to save something till near the end of the line. :-)
TW

Although I work for the HP calculator group, the comments and opinions I post here are my own.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Is 1▶a instead of a := 1 bad practice? (HP Prime)
« Reply #14 on: January 16, 2014, 03:14:20 pm »
I am pretty sure the ▶ symbol was implemented to help the TI folks transition to the HP Prime. The := syntax was implemented (again I am guessing) so that it would be easy to program on a PC and transfer to the calculator. So if you program on the calculator, either is fine. They even use the same keystrokes (if you have alpha locked for the := notation). On a PC, it would be very impractical to use ▶ unless you have a special setup.

Remember folks, te nSpire have too the both syntaxes!