Author |
Message |
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 10 Nov 2007 01:07:09 am Post subject: |
|
|
This is more of a posting to attach a download file for someone I meant to give to a day or two ago than it is announcing a new feature, but while I'm at it, I might as well pose the question.
The small routine, only about a hundred bytes, is designed to extract list elements out of an archived list. Since it's so small, I could insert this routine into Celtic III with no real net impact to memory. In fact, it might be beneficial in the event I have to work around further with lists and such.
Keep in mind that the program in the download will be expanded upon in Celtic III if I choose to add it in. At least in Celtic III, there will be *real* error checking, and the ability to read in other stuff. And perhaps an upgrade to allow status reading and stuffs from lists. Oh, the options are *so* there. You'll still need to read the ReadME file, though.
So, what do you think?
Last edited by Guest on 10 Nov 2007 01:13:03 am; edited 1 time in total |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
Posted: 10 Nov 2007 02:01:20 pm Post subject: |
|
|
I can see a good use for this in rpg games where there are numerous big lists. Having it archived would save lots of space. |
|
Back to top |
|
|
tifreak8x
Elite
Joined: 27 Aug 2005 Posts: 956
|
Posted: 10 Nov 2007 03:55:41 pm Post subject: |
|
|
bwhahaha, thank ya much! Now I can keep that event list archived for pokemonz... |
|
Back to top |
|
|
vuurrobin
Advanced Member
Joined: 09 Aug 2006 Posts: 428
|
Posted: 10 Nov 2007 06:52:58 pm Post subject: |
|
|
sounds like a usefull routine for celtic 3 |
|
Back to top |
|
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 14 Nov 2007 04:55:24 pm Post subject: |
|
|
I was also wondering about something regarding lists. I do not recall a way to extract a "formula" (y-equ string) out of a list in a way that a person would be able to use lists to store strings.
Would a Celtic III util be useful for this, or should I wait for someone to figure out how to do this in pure BASIC before I make a move?
Or if the method is known, I'd love to be enlightened on this, since all I've ever heard of is "it's impossible". If it is, then it goes to show how out of the loop I am wrt the BASIC scene. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 14 Nov 2007 05:01:17 pm Post subject: |
|
|
I've never seen a way to do it, at least not for an arbitrary string 'formula'. If you know something about the formula, you can find out what it is by evaluating it carefully, I suppose, but that's all you can do barring some exploit in the OS that hasn't been found yet. |
|
Back to top |
|
|
angel14995
Member
Joined: 13 Oct 2007 Posts: 181
|
Posted: 14 Nov 2007 05:37:04 pm Post subject: |
|
|
Do you mean like in a list the value of the 1st element is 7 and that changes and the value of the second element is a formula that relies on the first Element? Like this? L1={7,7L1(7)} and you are trying to extract the 7L1(7)?
Last edited by Guest on 04 Sep 2010 08:30:16 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 14 Nov 2007 05:43:05 pm Post subject: |
|
|
You can store a formula to a list, for example: "{1,X,X^2→L1 (the quotation mark distinguishes this from storing a list normally). This way, the formula is evaluated every time you access the list, so that if X changes, the value of L1 changes as well.
The reason this is interesting is that you can store any string to the list - "HELLO→L1 doesn't cause an error and saves the string "HELLO". Unfortunately, you can't extract the formula using Basic, so this would ordinarily be useless.
Last edited by Guest on 04 Sep 2010 08:31:04 pm; edited 1 time in total |
|
Back to top |
|
|
vuurrobin
Advanced Member
Joined: 09 Aug 2006 Posts: 428
|
Posted: 14 Nov 2007 05:54:10 pm Post subject: |
|
|
you can put a string in a list.
"HELLO->L1
but you can't get it out of the list. this also gives an error when you try to use L1
I'm not sure if this will be that usefull. we can already use strings, hacked strings, equation variables, (protected) programs and appvars. AFAIK, storing a string in a list makes that list useless most times, so I don't see any advantages in it.
[edit] beaten
Last edited by Guest on 14 Nov 2007 05:55:01 pm; edited 1 time in total |
|
Back to top |
|
|
simplethinker snjwffl
Active Member
Joined: 25 Jul 2006 Posts: 700
|
Posted: 15 Nov 2007 09:21:00 am Post subject: |
|
|
I think it would be useful. Lists are useful because they can have user-defined names, so if you can store and extract a formula/string to a list then you can have user-defined strings too. I don't think that the hacked strings can do that, so it would be a nice advantage. |
|
Back to top |
|
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 15 Nov 2007 02:45:30 pm Post subject: |
|
|
I'm unsure as to how useful the feature will be. It'll only be about another hundred or so bytes to implement it, including a change to the central file lookup routine, but I'm getting a load of "no" responses. Perhaps I should've made a poll regarding this?
---
Hmm. I just had an idea with regards to this. I'm just posting it here so I don't forget about it, but I can pass a variable name through Op1 when my parser hook's finished, so I wonder if I could perform a lookup on the list and then paste the variable name of the y-equ var you'll never be able to look up in the system equation list into Op1 to be used as output. Maybe that would work, but I can imagine this would have a very slight possibility of crashing the system, since I'm making it do something it wasn't originally intended to do. Then again, it *is* a variable just like anything else. Who knows without trying? |
|
Back to top |
|
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 20 Nov 2007 03:29:12 pm Post subject: |
|
|
*bump*
One last question about the archived list element thingie. Should I start the list element count at 1 or 0? That is, if you're using the det( function to access archived list elements... (btw, "24" is the function number I've assigned to this)
If it starts at 1, then det(24,"L1",1) will retrieve the first element from that list.
If it starts at 0, then det(24,"L1",1) will retrieve the second element from the list because det(24,"L1",0) would've retrieved the first element.
With the way the function would work, you could do something like this:
Code: For(A,1,99
If X=det(24,"L1",A
A->B
End
Because of the way Celtic III retrieves arguments from the FPS, this could easily be rewritten as:
Code: For(A,1,99
If X=det(24,A,"L1
A->B
End
Since string arguments and real number arguments are separated during argument fetching.
I'll probably have a plug about this in the ReadMe or somthing... but I won't do it right now. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 20 Nov 2007 04:56:39 pm Post subject: |
|
|
considering every built-in list command starts at 1, I think it would be best to keep that. |
|
Back to top |
|
|
vuurrobin
Advanced Member
Joined: 09 Aug 2006 Posts: 428
|
Posted: 20 Nov 2007 04:58:28 pm Post subject: |
|
|
I would go with 1, since the ti-os also go's with L1(1) for the first element. would be the least confusing .
edit: multipost with darkerline
Last edited by Guest on 04 Sep 2010 08:30:02 pm; edited 1 time in total |
|
Back to top |
|
|
Igrek
Member
Joined: 23 Aug 2007 Posts: 151
|
Posted: 04 Jan 2008 10:08:27 am Post subject: |
|
|
Iambian wrote: I was also wondering about something regarding lists. I do not recall a way to extract a "formula" (y-equ string) out of a list in a way that a person would be able to use lists to store strings.
[post="115938"]<{POST_SNAPBACK}>[/post]
I have a semi-finished asm program that gets this equation out of a list.
-It assumes that ans, and the lists equation are present in RAM (this shouldn't be a problem for ans)
-Doesn't work for L1-L6 (There is a sneaky way to do it for L2,L3,L4,L6 Want to know why? )
-Something else that isn't working correctly but I can't remember it...
If someone thinks it is useful, I can finish it.
Edit: Input: the name of the list as a string in ans
Output: Contents of this equation as a sting in ans / an empty string in ans if something went wrong.
Edit 2: It's current size is 161 Byte, if I'll fix these problems it will be around 200 bytes, but it might be possible to optimize it.
Last edited by Guest on 04 Jan 2008 11:24:31 am; edited 1 time in total |
|
Back to top |
|
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 04 Jan 2008 11:40:29 pm Post subject: |
|
|
I'd like to say something about "necroposting", but I've seen worse. Anyway...
The thing you quoted was made in the context of it being done from BASIC. Of course I had a way of doing it from ASM, but I never really implemented it. If you looked closely at the source near the input handling, you'd see a way I'd deal with list input, be it user-defined or system-defined.
If you haven't noticed, the equation part of the list isn't too tightly attached to the list. That is, the equation part is deleted if just about anything other than reading it occurs with the list.
Though one can make a routine that'll perform the function, I've fully realized that it would serve no real purpose. Sorry for the letdown, but creating such a program would be good for experience. And for someone that might, for some strange reason, "obfuscate" their program by using this little known function of the OS.
----
On a previous topic, I've selected the "start at 1" idea and found that I could use an input of zero to obtain the dimensions of that list, since you cannot use dim() on an archived... anything.
Last edited by Guest on 04 Jan 2008 11:41:00 pm; edited 1 time in total |
|
Back to top |
|
|
Igrek
Member
Joined: 23 Aug 2007 Posts: 151
|
Posted: 05 Jan 2008 04:01:14 am Post subject: |
|
|
Iambian wrote: If you haven't noticed, the equation part of the list isn't too tightly attached to the list. That is, the equation part is deleted if just about anything other than reading it occurs with the list.
[post="118204"]<{POST_SNAPBACK}>[/post]
Sorry about the necropost, I was walking around in the forum and a thought this was an active topic because it was the highest one in the list (I guess).
Could you tell me when it gets deleted, I never actually understood why it happens. Reading from a list where "hello" is stored it just gives an error. |
|
Back to top |
|
|
JoeYoung
Advanced Member
Joined: 15 Nov 2008 Posts: 316
|
Posted: 09 Feb 2009 10:07:13 pm Post subject: |
|
|
I hate to necropost, but will you ever have the ability to write to archived lists? or is it already included and i need to read the readme more? |
|
Back to top |
|
|
Iambian
Advanced Member
Joined: 13 Mar 2004 Posts: 423
|
Posted: 09 Feb 2009 11:59:02 pm Post subject: |
|
|
Just to put it out and I'm unsure if I've said anything of this sort, but you *cannot* edit *anything* archived. You can unarchive it, edit it, then archive it again, but never any direct editing.
Now... I know BrandonW will be a naysayer on this one but understand that to include routines to actually perform the edit wouldn't only take up a load of space in having to recreate routines to handle an entire portion of the TI-OS's file system, but doing such would wear down on the FlashROM and such edits like what you're talking about, wouldn't be easily or reliably done. It is better to unarchive, edit, then rearchive the list if you really want it to stay out of RAM.
The purpose of archiving is to keep things that will not change. If you don't have enough RAM to deal with it, why don't you stick stuff that won't change into archive so you'll have more space?
-----
EDIT: *grumbles about topic outdatedness*
Last edited by Guest on 10 Feb 2009 12:05:36 am; edited 1 time in total |
|
Back to top |
|
|
FloppusMaximus
Advanced Member
Joined: 22 Aug 2008 Posts: 472
|
Posted: 10 Feb 2009 06:31:35 pm Post subject: |
|
|
To elaborate a little bit, there are actually two technical obstacles here:
- You cannot write a one into the Flash; you can only write zeroes. If you're very lucky (say, you're trying to overwrite a floating-point 1 with a 0, or a 10 with a 1) then you can in theory make that modification in-place. Otherwise, the only way to "change" the archived list is to move it to a different place in Flash -- in essence, to unarchive and re-archive it. The space consumed this way gets reclaimed only when you garbage-collect (so if your program is constantly changing stuff in Flash, you can expect to have to garbage-collect frequently.) Garbage-collecting, incidentally, is what wears down the Flash chip (though it's not something to be worried about most of the time.)
- The calculator OS has been specifically designed to make it impossible for any user program to write directly into Flash. There are ways to break this protection (BrandonW, in particular, has done a lot of work on this), but doing so is rather complicated, and there's no guarantee that it will continue to work with future versions of the OS. In the absence of such an exploit, the only ways for user programs to read and write Flash are by archiving, unarchiving, and deleting variables. |
|
Back to top |
|
|
|