I'm going to rework the code I had for the "TI-Basic Library" into a DIY-Library maker! Got some code that repeats over-and-over, and you want to save space? Easy! You can create your own customly-named AppVar, holding all the information, from the name of the function, to the subroutines they execute! The interpreter only takes up 170 bytes of RAM, so provided you can save that much with whatever algorithms you use with DIYLIB, it could potentially be helpful to you!
Unfortunately, there are some drawbacks so far:
*Can only handle one input after the (. You can technically have more than one input, you just have to make sure it isn't destroyed by any variable used by prgmDIYLIB
*Can only handle number inputs
*Only technically works on the CSE. It would be pretty easy to port to monochrome calcs (and possibly the CE), so if you're interested, contact me!
*Running it is most likely slower than just typing out the equation normally

(note: This is not a serious project. I finished this in like 4 hours and felt like it was cool to mess around with)


Here's the information basically telling you DIYLIB is a lot slower than just the equation:
Running this set of code to determine speed. Here you can see how many times the loop repeats and the command/equates I used.

Code:

"rowSwap(LIBNEW00→Str0
startTmr→T
For(F,1,150
"DIGIT(F
prgmDIYLIB
End
checkTmr(T->I
Ans/150→G
startTmr→T
For(F,1,150
int(1+log(real(F+(0=real(F
End
checkTmr(T)→J
Ans150→H
Disp G,H," ",I,J
Pause

Now here's the results.
[loops] = 150: DIYLIB took an average of .16 seconds to process each request, and the straight command took .013333.... seconds.
DIYLIB, in 150 loops, took ~24 seconds, while the straight command only took ~2.

►Download: http://www.mediafire.com/file/07cysaz4blkoapg/DIYLIBv1.zip
This is pretty neat!
123outerme wrote:
*Can only handle one input after the (. You can technically have more than one input, you just have to make sure it isn't destroyed by any variable used by prgmDIYLIB

A few months ago, I made a little terminal program (since that seemed to be what all the cool kids were doing Razz) My terminal program used a similar input method, which is kind of like just writing out characters and pretending they are a token. I made it accept an arbitrary number of arguemnts by using a little opcode which actually proved to be quite handy. Here are the steps, actual code will follow:
    1) store the input as a string
    2) chop off the token part to just keep the arguments
    3) add a "{" at the beginning
    4) turn the string into a list variable using expr()
    5) use the opcode to store the arguments to variables that can then be used in the command

Annotated code:

Code:
Input "",Str1 //Input something like ISPRIME(7
{1,6,10,15,22,25,28,31,35,40,44->L2 //just the positions of the beginning of the token name in the string below
inString("GAMMAQUADCUBICQUARTICCOTSECCSCZETABCONVBETAISPRIME",sub(Str1,1,~1+inString(Str1,"( //finding what token was typed out
Ans=L2
sum(AnscumSum(binomcdf(10,0->N //converting a weird number into a command number (1 is GAMMA, 2 is QUAD, 3 is CUBIC, etc.)
If N
augment(DeltaList(L2),{7
expr("{"+sub(Str1,Ans(N)+2,length(Str1)-Ans(N)-1->L1 //steps 3 and 4 from above
Asm(prgmTOVARS //the opcode


prgmTOVARS:
Asm84CEPrgmCD500F02FE01C01AFE1B38023E1BEB2323473E41C5F5E5F5CD840302F132F905D0CD0C05023004CD340502E101090000EDB0F13CC110DDC9

TOVARS is an opcode I found which simply takes a list in Ans and stores the first element to A, the 2nd element to B, and so on. When you are executing the custom command, you will need to make sure that the first argument is A, the second is B, and so on.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement