HP Forums
5 minus minus 6 on in HOME and CAS - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: 5 minus minus 6 on in HOME and CAS (/thread-8682.html)



5 minus minus 6 on in HOME and CAS - Marcel - 07-14-2017 01:53 AM

Hi!
In HOME view, 5 - -6 is OK but
in CAS view 5 - -6 show error!
I think this is not a bad math expression.
Marcel


RE: 5 minus minus 6 on in HOME and CAS - Joe Horn - 07-14-2017 04:51 AM

In CAS, it works ok if you type a space between the subtract symbol and the negative sign, and only errors if there is no space between them. Strange.

5--6 → error
5- -6 → ok


RE: 5 minus minus 6 on in HOME and CAS - parisse - 07-14-2017 05:52 AM

The reason is that you can write j-- to decrement j.


RE: 5 minus minus 6 on in HOME and CAS - webmasterpdx - 07-14-2017 08:58 AM

How come this isn't documented. A while ago, I was looking for a ++ and -- operator and was trying to create macros (where I discovered that define wasn't a macro generator but a short way to create a program)....but I was doing this to create my own decrement/increment functions....didn't know they already existed....
Also, decrement() and increment() aren't in the catalog.
These are functions that should run in home mode too....however, when I tried to run CAS.decrement(x), it got converted to decrement(5) and didn't decrement x in home mode.....is there a way to get decrement to work in home mode?
Thx
-Donald


RE: 5 minus minus 6 on in HOME and CAS - toml_12953 - 07-14-2017 12:50 PM

(07-14-2017 08:58 AM)webmasterpdx Wrote:  How come this isn't documented. A while ago, I was looking for a ++ and -- operator and was trying to create macros (where I discovered that define wasn't a macro generator but a short way to create a program)....but I was doing this to create my own decrement/increment functions....didn't know they already existed....
Also, decrement() and increment() aren't in the catalog.
These are functions that should run in home mode too....however, when I tried to run CAS.decrement(x), it got converted to decrement(5) and didn't decrement x in home mode.....is there a way to get decrement to work in home mode?
Thx
-Donald

increment and decrement don't work at all for me, even in CAS mode.

a:=8
decrement(a)
gives
decrement(8) then when I display a, I still get 8.


RE: 5 minus minus 6 on in HOME and CAS - Han - 07-14-2017 02:09 PM

Carefully reread parisse's post: he uses j-- and not decrement(j). The "decrement()" however is what gets displayed in the history.


RE: 5 minus minus 6 on in HOME and CAS - DrD - 07-14-2017 06:50 PM

or if you want to stick with variable a:

[CAS]
a:=8;
a--; // displays decrrement(a) and a==7
a++; // displays increment(a) and a==8


RE: 5 minus minus 6 on in HOME and CAS - toml_12953 - 07-14-2017 07:33 PM

(07-14-2017 06:50 PM)DrD Wrote:  or if you want to stick with variable a:

[CAS]
a:=8;
a--; // displays decrrement(a) and a==7
a++; // displays increment(a) and a==8

Just so. I wish it worked in Home mode and HPPL programs!
Thanks.


RE: 5 minus minus 6 on in HOME and CAS - DrD - 07-14-2017 08:48 PM

I suppose you could ask Tim to include it on the new features list, referred to not so long ago.

[HOME]
a:=7;
CAS("a++"); ==> a increments to 8


RE: 5 minus minus 6 on in HOME and CAS - Joe Horn - 07-14-2017 11:34 PM

(07-14-2017 07:33 PM)toml_12953 Wrote:  
(07-14-2017 06:50 PM)DrD Wrote:  or if you want to stick with variable a:

[CAS]
a:=8;
a--; // displays decrrement(a) and a==7
a++; // displays increment(a) and a==8

Just so. I wish it worked in Home mode and HPPL programs!
Thanks.

It DOES work in HP PPL programs, between #cas and #end. It even works with non-CAS variables (e.g. A-- and A++).


RE: 5 minus minus 6 on in HOME and CAS - Tim Wessman - 07-15-2017 08:29 PM

It isn't allowed in home, and we'd have completely removed it from the CAS if possible. This type of construct does not belong in a math focused *calculator*. The problem is, ++ -- is deeply down in the CAS parser and we couldn't remove it.

Try explaining something like --4+++5++ to a student and why it would be valid... (it would be in the HOME parser/evaluation if we enabled increment/decrement type operators)

While in a *programming* language they might make sense, on a calculator that is primarily focused on *math* they do not. Not all languages allow them either because they can introduce confusion, and don't really gain you anything other then a few less characters to type.

They are not documented because we don't want it being used.


RE: 5 minus minus 6 on in HOME and CAS - webmasterpdx - 07-16-2017 09:44 AM

I'd rather see some macro type functionality...


RE: 5 minus minus 6 on in HOME and CAS - DrD - 07-16-2017 11:08 AM

(07-16-2017 09:44 AM)webmasterpdx Wrote:  I'd rather see some macro type functionality...

The Prime does have [Shift] [Define], useful for macro functionality. Considering the product purpose of this device, how would you justify anything more (or differently) to, say, a room full of marketing decision makers?

A lot of us know what you are after, many of us would readily buy such a device, but the Prime isn't it. There is a frustration in that the Prime is very close to what is wanted, yet falls short in some respects. That is more a marketing thing, and someday, someone may develop a professional tool. In spite of the fact that it seems so do-able with the Prime, we are still waiting.

Evolving a dream machine might be an interesting thing in which to try to get design consensus. However, a Google scenario, where you attempt to enter an objective, and quickly refine the result, might be a good start. An all knowing, all seeing eye, with mind reading input, is such a simple request, oh yeah, and a government program to mandate that it be freely available in the USA, at least for certain special groups.


RE: 5 minus minus 6 on in HOME and CAS - webmasterpdx - 07-17-2017 08:12 PM

define isn't a macro...its just another way to write a one line program...


RE: 5 minus minus 6 on in HOME and CAS - DrD - 07-17-2017 08:59 PM

What, exactly, is your idea of a macro? (Bear in mind, definition of the term, and computer language(s) et al, are not exactly an unheard of concept in this forum).

More precisely, what macro operation are you expecting, within the design objective of the hp Prime? I think the [Define] key actually does meet the definition of macro. Perhaps reassigning keys, (custom keypresses), and the user keyboard feature might do the trick for you, further details in the user guide.

As a tool for educators and students, professional applications are likely to be met with frustration, if you let your expectations take you that far. Basic I/O like RTU, ADC/DAC, data logger, and comm's with the outside world, would be such an enhancement, and seems such a obvious improvement that it would be bound to return any such investment. It is unfortunate that this is outside the scope of the product, and Que sera, sera, to purloin a phrase from Doris Day's day.

-Dale-


RE: 5 minus minus 6 on in HOME and CAS - webmasterpdx - 07-18-2017 05:53 AM

I already posted this stuff here....towards the bottom:
http://www.hpmuseum.org/forum/thread-8684.html