Post Reply 
Request: "Done" instead of 0
08-26-2018, 12:56 PM (This post was last modified: 08-26-2018 03:01 PM by compsystems.)
Post: #1
Request: "Done" instead of 0
Hello
In a presentation of computer algebraic systems, I show the difference between numerical and symbolic languages

Sample
PHP Code:
#include<stdio.h>
int main() {
    
printf("%f",x+1);
    return 
0;

output: error: 'x' was not declared in this scope

PHP Code:
#include <iostream>
using namespace std;

int main(int argcchar *argv[]) {
    
cout << 4/3+1/<< endl;
    return 
0;

output: 1

in the hp-prime
print(4/3+1/3) [enter] show 5/3 ok
but then [esc] show 0 ?

in c++ the output return 0; but the CAS is not c/c++, for this reason this generates confusion on history view, when run the hp-prime in a classroom or you want to take a screenshot

try
print(4/3+1/3) -> 0


Please HP-team return the word "Done" (history view) instead of the number 0 or best the last printing statement

print(4/3+1/3) [enter] show 5/3 ok
but then [esc] -> 5/3

The following screenshot shows the problem by showing zero the sum of the numbers 4/3+1/3.


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
08-26-2018, 01:25 PM
Post: #2
RE: Request: "Done" instead of 0
We've been over this for about 5 years now. This does not improve clarity in any way and simply makes the lives of anyone trying to test output difficult. You constantly want to be converting things into strings, error messages and other things that don't belong there.

I'm sorry if you feel otherwise, but apart from you I've not ever heard a single person complaining in this direction. No educator, no instructor, and noone doing development.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
08-26-2018, 01:58 PM (This post was last modified: 08-27-2018 02:54 PM by compsystems.)
Post: #3
RE: Request: "Done" instead of 0
this request to replace 0 -> last expression of print, it is so simple that it would take a few seconds to change the code, above I explain the cause and effect of this change, it is not because I want it but it gives clarity.

Anyone else that supports my request?

Thanks
Find all posts by this user
Quote this message in a reply
08-27-2018, 09:45 AM (This post was last modified: 08-27-2018 09:48 AM by ijabbott.)
Post: #4
RE: Request: "Done" instead of 0
The text written by PRINT(Expr) is a "side effect" of the function, and need not be related to its return value. Giac currently chooses to return 0. The print() function in Python chooses to return None. The printf() function in C chooses to return the number of characters written. There is no "One True Way"™.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 




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