CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 125 users online: 6 members, 91 guests and 28 bots.
Members: Alebcay, fortytwo, Spyro543.
Bots: VoilaBot (2), Spinn3r (1), MSN/Bing (1), Magpie Crawler (3), VoilaBot (1), Googlebot (12), Googlebot (6), MSN/Bing (2).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
Reapex


Member


Joined: 11 Sep 2008
Posts: 144

Posted: 10 Aug 2009 09:57:50 am    Post subject: String to list and Back again


Code:
:Ans→Str7
:ClrList∟STR
:1→I
:For(I,1,length(Str7
:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
:inString(Ans,sub(Str7,I,1))→∟STR(I)
:End
:DelVar Str7ClrHome
:Disp "CONVERTED STR","IN ∟STR"


And


Code:
:DelVar IAns→∟TEMP
:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz→Str0
:sub(Ans,∟TEMP(1),1)→Str7
:For(I,2,dim(∟TEMP
:Str7+sub(Str0,∟TEMP(I),1→Str7
:End
:ClrHome
:Disp "CONVERTED LIST","IN Str7"

What do you guys think?
Any optimizations? :O
Back to top
utopiahunter


Newbie


Joined: 30 Jun 2008
Posts: 21

Posted: 10 Aug 2009 11:37:32 am    Post subject:

For the first code I wouldn't think it is necessary to store 1 to 'I' since the "For(" loop will do that For(you). For both codes I should remind that it's not necessary to always put the ending parentheses and quotes even immediately before the store token. I believe parsing the program through SourceCoder will do those optimizations for you. Other than that it's pretty solid.

The same thing for the second code; you don't need to delete 'I' since "For(" will store 2 to it initially anyways. Here's what I'd do


Code:
:Ans→∟TEMP
:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz→Str0
:"→Str7
:For(I,1,dim(∟TEMP
:sub(Str7,∟TEMP(I),1
:If length(Str7
:Str7+Ans
:Ans→Str7
:End
:ClrHome
:Disp "CONVERTED LIST","IN Str7


I don't know if it needs to be explained but as you can see, it can save a few bytes.
Back to top
lafferjm


Calculator Deity


Joined: 14 Mar 2006
Posts: 1529
Location: at my house

Posted: 10 Aug 2009 08:03:56 pm    Post subject:

http://www.cemetech.net/forum/viewtopic.php?t=1479
_________________

Back to top
Reapex


Member


Joined: 11 Sep 2008
Posts: 144

Posted: 10 Aug 2009 08:39:39 pm    Post subject:

D'oh D:
Oh well, nice knowing I'm able to code it Very Happy
Back to top
Zaphod Beeblebrox


Member


Joined: 11 Mar 2007
Posts: 153

Posted: 10 Aug 2009 09:43:07 pm    Post subject:


Code:

seq(inString("ABCDEFG ... Z? .",sub(Str1,N,1)),N,1,length(Str1

_________________
Project Status:
- Lunar IDE 1 - 100% | Done
- Lunar IDE 2 - 60% | Finishing unfinished bits
Back to top
rthprog


Expert


Joined: 21 Sep 2007
Posts: 726
Location: Pittsburgh, PA

Posted: 11 Aug 2009 09:10:32 am    Post subject:

precisely!


Code:

seq(inString("ABCDEFG ... Z? .",sub(Str1,N,1)),N,1,length(Str1



Code:
:":
:For(N,1,dim(L1
:Ans+sub("ABCDEFG ... Z? .",L1(N),1
:End
:sub(Ans,2,dim(L1
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
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

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.026166 seconds.