The Museum of HP Calculators

HP Forum Archive 17

[ Return to Index | Top of Index ]

TI NSpire now supports user programs
Message #1 Posted by Don Shepherd on 6 Oct 2007, 9:54 a.m.

The latest operating system now supports user-defined programs in addition to user-defined functions. Lack of programming capability was a major deficiency of the original NSpire. It looks like they listened to those who complained.

      
Re: TI NSpire now supports user programs
Message #2 Posted by Namir on 6 Oct 2007, 12:31 p.m.,
in response to message #1 by Don Shepherd

Thank you for the update Don. I just updated one OS of one TI NSpire CAS calculator, and working on updating the second one!

Looks like TI also updated the manuals for the calculator.

Namir

Edited: 6 Oct 2007, 5:50 p.m.

      
Re: TI NSpire now supports user programs
Message #3 Posted by Bruce Bergman on 6 Oct 2007, 6:44 p.m.,
in response to message #1 by Don Shepherd

So, what do the programs look like? Is it a TI-specific language? Something akin to BASIC?

thanks, bruce

(btw, Don, I'll get back to your email shortly... ;-)

            
Re: TI NSpire now supports user programs
Message #4 Posted by Don Shepherd on 6 Oct 2007, 7:17 p.m.,
in response to message #3 by Bruce Bergman

It's a lot like BASIC, or TI-BASIC. Here is our HCC2007 programming contest (rearrange the digits of an input number into numerical order) done on the NSpire:

Define rev_digits(num)=Prgm
:Local i,a,n
:a:={}
:For i,0,iPart(log(num,10))
:a:=augment(a,{mod(intDiv(num,10^(i)),10)})
:EndFor
:SortA a
:n:=0
:For i,1,dim(a)
:n:=n+a[i]*10^(dim(a)-i)
:EndFor
:Disp n
:EndPrgm

I just get each digit of the input number and store it in a list, then sort the list, then convert the list items back into an integer number.

                  
Re: TI NSpire now supports user programs
Message #5 Posted by Namir on 6 Oct 2007, 7:37 p.m.,
in response to message #4 by Don Shepherd

Nice listing Don. Thanks!!

Namir

                  
Re: TI NSpire now supports user programs
Message #6 Posted by hugh steers on 7 Oct 2007, 4:57 p.m.,
in response to message #4 by Don Shepherd

hi Don,

for comparison, here's the same problem in LUA on the 50g,

function sortNum(n)
   a = {tostring(n):byte(1,-1)}  -- unpack unto array 
   table.sort(a) 
   return tonumber(string.char(unpack(a))) -- pack back and return
end

Edited: 7 Oct 2007, 4:58 p.m.

                        
Re: TI NSpire now supports user programs
Message #7 Posted by Don Shepherd on 7 Oct 2007, 5:29 p.m.,
in response to message #6 by hugh steers

Very compact code, Hugh, thanks. Is LUA an add-on language to the 50g? I'm not familiar with it, but then I'm not really an RPL guy.

                              
Re: TI NSpire now supports user programs
Message #8 Posted by hugh steers on 7 Oct 2007, 6:45 p.m.,
in response to message #7 by Don Shepherd

hi don,

"not an RPL" guy", i'm with you there. although i like RPN, ive always found RPL clumsy and almost totally unreadable.

you might like to try your hand at lua on the 50g. get my latest release at:

http://sourceforge.net/projects/hplua

should be hplua-1.0.1.zip. this contains the source code, but all you need is the ARMToolbox and the flua.hp program. once loaded you can try some of my samples like sunset.lua and sudoku.lua

also checkout www.lua.org for the language reference and also the book, "Programming in Lua, Second Edition (Paperback) by Roberto Ierusalimschy", is highly recommended.

good luck!

                                    
Re: TI NSpire now supports user programs
Message #9 Posted by Don Shepherd on 7 Oct 2007, 8:59 p.m.,
in response to message #8 by hugh steers

Thanks, Hugh. I don't have a 50g (there was a door prize of same, but they didn't call my number early enough!). I will check out that book, however, as I am intrigued by how such a small bit of code can do what it does. Very nice.

            
Re: TI NSpire now supports user programs
Message #10 Posted by Don Shepherd on 7 Oct 2007, 8:50 a.m.,
in response to message #3 by Bruce Bergman

There is a significant omission from the BASIC instruction set on the NSpire: the Input command. From what I have read, I think this was done on purpose. TI apparently wants the NSpire to be strictly an educational tool, not a "gaming" machine with interactive inputs. Without an Input command, kids who are supposed to be learning the characteristics of a right triangle will not be playing Legends of Doom instead. This is probably the reason that only functions were originally supported.

The only way to provide inputs to your program is to pass them as arguments when you run the program. Hey, that's how FORTRAN worked on the Univac 1108 when I started programming in 1974!

                  
Re: TI NSpire now supports user programs
Message #11 Posted by Namir on 7 Oct 2007, 9:15 a.m.,
in response to message #10 by Don Shepherd

I checked the Reference Manual of the TI nspire and, you are right, there is no Input statement!!!!

Having not gone over the entire Reference Manual yet, can you access individual matrix elements using [row,col] or (row,col)?

Namir

                        
Re: TI NSpire now supports user programs
Message #12 Posted by Don Shepherd on 7 Oct 2007, 9:17 a.m.,
in response to message #11 by Namir

I believe so. I have not done a matrix yet, but you access individual list entries like this: if list a = {1, 2, 3, 4}, then a[3] = 3.

                              
Re: TI NSpire now supports user programs
Message #13 Posted by Namir on 7 Oct 2007, 9:19 a.m.,
in response to message #12 by Don Shepherd

Thanks!!

BTW in the HHC2007 group picture I appear right behind you in the line of vision!!! I hold in my hands my new HP-35s and an early version of the HP-41C that my son's university was willing to retire in my care. Thank you NAU!!!

:-)

Namir

Edited: 7 Oct 2007, 9:20 a.m.

                  
Re: TI NSpire now supports user programs
Message #14 Posted by Eric Smith on 8 Oct 2007, 4:00 a.m.,
in response to message #10 by Don Shepherd

Quote:
I think this was done on purpose. TI apparently wants the NSpire to be strictly an educational tool, not a "gaming" machine with interactive inputs.

And we all know that INPUT serves no purpose other than games.

What a crock. :-(

Quote:
The only way to provide inputs to your program is to pass them as arguments when you run the program. Hey, that's how FORTRAN worked on the Univac 1108 when I started programming in 1974!

I'm 99.99% certain that FORTRAN IV on the 1108 supported input files.

                        
Re: TI NSpire now supports user programs
Message #15 Posted by Don Shepherd on 8 Oct 2007, 7:26 a.m.,
in response to message #14 by Eric Smith

Yeah, that's true. I meant interactive input with a live user. In those days of mainframes only, it was all file processing.

                              
Re: TI NSpire now supports user programs
Message #16 Posted by Eric Smith on 8 Oct 2007, 5:05 p.m.,
in response to message #15 by Don Shepherd

The 1108 supported interactive terminals (e.g., model 33 or 35 Teletypes, Univac DCT 500 or 100, or Uniscope 100 or 300), which could be opened as files. Your site may not have had any, but it wasn't a fundamental limitation of the computer or software.

There was even a "Conversational Fortran V" for it.

                                    
Re: TI NSpire now supports user programs
Message #17 Posted by Don Shepherd on 8 Oct 2007, 5:58 p.m.,
in response to message #16 by Eric Smith

Eric, I worked on that Univac 1108 as my first programming job in 1974 at the US Census Bureau in Suitland Maryland (just outside Washington DC). In those days, we punched our FORTRAN progam source code on punch-cards, submitted a batch job overnight to compile the program, and came back the next day to see how many errors we had. Those were the days! Then came the model 33 teletypes, then came the DCT interactive terminals. But the 1108 was never as good at interactive things as it was at batch things. The Census Bureau was a huge file processing organization. All of our programs were designed to read tape files, update the data with various transactions, and write back out onto tape. I forget the tape density, but I think it was 6250 bpi when I left the Bureau around 1983. A file for the whole US might be 100 tapes.

Since our applications did so much IO, the Bureau system guys wrote their own IO system that all us programmers used, called CENIO. It was (supposedly, I never doubted them though) much faster than standard FORTRAN IO.

In those glory days before the personal computer, we never imagined that anyone could actually have and use a computer at home. How times have changed.

                                          
Re: TI NSpire now supports user programs
Message #18 Posted by Bruce Bergman on 8 Oct 2007, 6:55 p.m.,
in response to message #17 by Don Shepherd

This was my experience also. Big fat decks of cards, HOPEFULLY numbered so that the inevitable "whoops!" didn't cause 52-card-pickup (or in some cases, 1052-card-pickup :-), and data was provided inline or in a separate deck. I was lucky if the results came back the next day; it usually took a day or so to get my job run. That was, after all, the value in desk checking your program -- you didn't want to have to resubmit it because you screwed it up somewhere.

I didn't even see "real" input methods until the paper tape machine came along. I could feed my program in again and again after meticulously punching the tape the first time. Back then, the paper tape seemed like MAGIC compared to decks of Fortran cards. ;-)

Ah, how quickly we take technology for granted these days...

thanks, bruce

Edited: 8 Oct 2007, 6:58 p.m.

                                          
Re: TI NSpire now supports user programs
Message #19 Posted by Eric Smith on 8 Oct 2007, 7:19 p.m.,
in response to message #17 by Don Shepherd

My point is that Fortran on the 1108 was certainly capable of both:

  • use of interactive terminals
  • data input from various sources, including interactive terminals

Sure, it was better at batch, and that was how most people used it, but it wasn't the only possibility. The Executive had support for interactive use before 1970, though I'm not sure exactly when it became available. I didn't use an 1100 series machine until the early 1980s, so I'm not as well-versed in its history as the DEC machines.

Quote:
I forget the tape density, but I think it was 6250 bpi when I left the Bureau around 1983.

Sounds about right. The switch from 800 bpi NRZI to 1600 bpi PE occurred in the early to mid 1970s, and 6250 bpi GCR became available in the late 1970s. Some vendors offered 3200 bpi (PE?), but it wasn't a standard and never caught on. (Before 9-track tape there was 7-track at 200, 556, or 800 BPI.)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall