Post Reply 
Any options for better interactive terminal-style I/O?
07-25-2018, 10:59 PM
Post: #1
Any options for better interactive terminal-style I/O?
Right now, the Prime just has PRINT(), which can clear the screen, or print a line of text. There's also the INPUT() function, but that displays full-screen input forms, much like INFORM on the 48.

Are there any libraries floating around that provide more traditional interactive terminal I/O? Like the sort of thing you'd get with Disp/Input on a TI, or Write/WriteLn/ReadLn in Turbo Pascal, or PRINT/INPUT in just about any old version of BASIC.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-26-2018, 03:56 PM (This post was last modified: 07-26-2018 04:06 PM by compsystems.)
Post: #2
RE: Any options for better interactive terminal-style I/O?
Hello, this is a very requested requirement, I do not know what is the difficulty of incorporating it, hardware?

The first step is to include xcas printf cmd

An example of code between HP-PRIME_XCAS and XCAS, notice how difficult and ugly/primitive it is to read mathematical expressions in 1D

XCAS HPPRIME CODE
PHP Code:
#cas
    
terminalViewTest():=
    
begin
        local x
y;
        
assumexsymbol ); 
        
assumeysymbol );
        
autosimplify(nop);
        
DispG
        
ClrIO
        print( 
"Terminal View, 2D printing" );
        
        print( 
"" );      
        print( 
"Expr0:" );
        print( (
x^3-6*x^2+11*x-x=y) + (x^4-x^3-6*x^2+11*x-6)/x^6);
        
        print( 
"" );
        print( 
"Expr1:" ); print( "" ); f(x):=x^3-2*x^2+1*x-1;
        print( 
'f(x)' ); print( "" );
        print( 
f(x) );print( "" );
        
        print( 
"" );
        print( 
"Expr2:" ); print( "" );
        print( 
'f(x) | x=y' ); print( "" );
        print( 
'x^3-2*x^2+1*x-1 | x=y' ); print( "" );
        print( 
f(x) | x=); print( "" );
        print( 
'f(y)' ); print( "" );
        print( 
f(y) ); print( "" );
        
        print( 
"" );
        print( 
"Expr3:" ); g(x):=1/(x+3);
        print( 
'g(x)' ); print( "" );; 
        print( 
g(x) );  print( "" );
   
        print( 
"" );     
        print( 
"Expr4:" );
        print( 
'f(g(x))' ); print( "" ); 
        print( 
f(g(x)) ); print( "" );

        print( 
"" );     
        print( 
"Expr5:" );        
        print( 
'g(f(x))' ); print( "" );
        print( 
g(f(x)) ); print( "" );
        
        return 
"Done";
    
end;
#end 


XCAS CODE
PHP Code:
terminalViewTest():={
        
local xy;
        
assumexsymbol ); 
        
assumeysymbol );
        
autosimplifynop) ;
        
DispG
        
ClrIO
        
printf"Terminal View, 2D printing" );
        
        
printf"" );      
        
printf"Expr0:" );
        
printf( (x^3-6*x^2+11*x-x=y) + (x^4-x^3-6*x^2+11*x-6)/x^6);
        
        
printf"" );
        
printf"Expr1:" ); printf"" ); f(x):=x^3-2*x^2+1*x-1;
        
printf'f(x)' ); printf"" );
        
printff(x) );printf"" );
        
        
printf"" );
        
printf"Expr2:" ); printf"" );
        
printf'f(x) | x=y' ); printf"" );
        
printf'x^3-2*x^2+1*x-1 | x=y' ); printf"" );
        
printff(x) | x=); printf"" );
        
printf'f(y)' ); printf"" );
        
printff(y) ); printf"" );
        
        
printf"" );
        
printf"Expr3:" ); g(x):=1/(x+3);
        
printf'g(x)' ); printf"" );; 
        
printfg(x) );  printf"" );
   
        
printf"" );     
        
printf"Expr4:" );
        
printf'f(g(x))' ); printf"" ); 
        
printff(g(x)) ); printf"" );

        
printf"" );     
        
printf"Expr5:" );        
        
printf'g(f(x))' ); printf"" );
        
printfg(f(x)) ); printf"" );
        
        return 
"Done";
}:; 

[Image: terminalView_xcas_image00.png]


poll
Is anyone else interested in having a better terminal view?

.
Find all posts by this user
Quote this message in a reply
07-26-2018, 04:42 PM
Post: #3
RE: Any options for better interactive terminal-style I/O?
(07-26-2018 03:56 PM)compsystems Wrote:  The first step is to include xcas printf cmd

That's a great idea, although I guess the Terminal widget will only support the current plain text output, like a traditional terminal. Displaying textbook-formatted output would require a different sort of widget more like the notebook format used for interactive calculations.

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




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