Post Reply 
Large 50g program example
06-19-2015, 01:02 PM
Post: #7
RE: Large 50g program example
(06-19-2015 09:50 AM)Tugdual Wrote:  Very instructive. So the idea is really to split the code in as many variables as functions needed. This seems to confirm the idea that the program being a set of variables all in the same directory, the directory itself becomes the program...

You are correct, a variable is also a function and a RPL command. Giving proper names to subroutines is extremely important for code readability, especially in RPL which is not so friendly to the eyes, so even for not-so-large projects it's a good idea to use several named variables/commands.
The way I always organize my code is one directory per program. The directory contains the source code in the form name.txt (as many as needed), which is then compiled into the 'name' variable. This way you get to keep the commented source code. When it's time for release, simply copy the directory, remove all .txt variables and make a library out of it.
And, using one directory per program is also helpful for easy backups. Just throw the following code inside a directory, and will recreate the directory on the SD card, with one file per variable (doesn't do recursive directories, though):

Code:

<< PATH TAIL "/" SWAP
ADD "/" + ∑LIST VARS ADD VARS 2.
<< RCL SWAP 3. →TAG DUP PURGE
STO 0. >>
DOLIST DROP
>>

I always use the same name for the backup program: SDBACK, and I make sure it never conflicts with the actual source code. The backup program gets backed up too, but that doesn't bother me.

Claudio
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Large 50g program example - Tugdual - 06-19-2015, 05:41 AM
RE: Large 50g program example - Paul Dale - 06-19-2015, 06:25 AM
RE: Large 50g program example - Tugdual - 06-19-2015, 09:50 AM
RE: Large 50g program example - Bruno - 06-19-2015, 09:59 AM
RE: Large 50g program example - BruceH - 06-24-2015, 08:15 PM
RE: Large 50g program example - Claudio L. - 06-19-2015 01:02 PM
RE: Large 50g program example - ttw - 06-19-2015, 06:55 AM
RE: Large 50g program example - Claudio L. - 06-19-2015, 01:09 PM
RE: Large 50g program example - Tugdual - 06-19-2015, 01:36 PM
RE: Large 50g program example - Joe Horn - 06-20-2015, 02:58 AM
RE: Large 50g program example - Claudio L. - 06-23-2015, 03:49 PM
RE: Large 50g program example - fyescas777 - 07-06-2015, 02:24 AM
RE: Large 50g program example - Tugdual - 07-06-2015, 10:29 AM
RE: Large 50g program example - Hlib - 08-27-2016, 08:29 AM



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