home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 01e / let12.zip / LET.DOC < prev    next >
Text File  |  1987-09-17  |  72KB  |  1,849 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                                           
  11.  
  12.  
  13.  
  14.                                           
  15.  
  16.  
  17.  
  18.                                         LET                                        LET
  19.  
  20.                             Finally, DOS has the ability
  21.  
  22.                             to use environment variables
  23.  
  24.                              to their fullest capacity.
  25.  
  26.                                           
  27.  
  28.                            Copyright Thomas Tuerke, 1987
  29.                            Educational Software Products
  30.                                   1004 Hart Court
  31.                                  Novato, CA  94947
  32.  
  33.                  
  34.  
  35.                   You are free to copy and share LET with others on
  36.             these three conditions:
  37.  
  38.             1.   The program and all associated files are distributed
  39.                  intact, and in an unmodified form.
  40.  
  41.             2.   No charge be assessed for the distribution of LET, save
  42.                  reasonable costs for duplication.
  43.  
  44.             3.   This notice, and the copyright notice within LET
  45.                  itself, are not bypassed or removed.
  46.  
  47.                                      Thank you.
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                            LET -- (c) Thomas Tuerke, 1987
  71.  
  72.  
  73.  
  74.                                  TABLE OF CONTENTS                                 TABLE OF CONTENTS
  75.  
  76.  
  77.                  
  78.             I. INTRODUCTION........................................... 1
  79.             II. BROTHER, CAN YOU SPARE A DIME?........................ 1
  80.             III. OPERATION............................................ 1
  81.             IV. INSTALLATION.......................................... 2
  82.             V. SYNTAX................................................. 3
  83.             VI. FUNCTIONS............................................. 6
  84.                 A. Parameters to Functions............................ 6
  85.                 B. Arithmetic Functions............................... 6
  86.                     1. Add Sum Plus +................................. 7
  87.                     2. Sub Minus -.................................... 7
  88.                     3. Mult Times Product *........................... 8
  89.                     4. Div /.......................................... 8
  90.                     5. Mod %.......................................... 9
  91.                 C. String Functions................................... 9
  92.                     1. Ascii Asc...................................... 9
  93.                     2. Ask........................................... 10
  94.                     3. Char Chr...................................... 10
  95.                     4. Concat........................................ 11
  96.                     5. Dateline...................................... 12
  97.                     6. Do............................................ 13
  98.                     7. Dup........................................... 14
  99.                     8. Filespec...................................... 14
  100.                     9. Fill.......................................... 15
  101.                     10. Length Len................................... 18
  102.                     11. Lower........................................ 18
  103.                     12. Pos.......................................... 19
  104.                     13. Proper....................................... 19
  105.                     14. Read......................................... 20
  106.                     15. Replace...................................... 21
  107.                     16. Substr Mid................................... 22
  108.                     17. Trim......................................... 22
  109.                     18. Upper........................................ 23
  110.                     19. Words........................................ 23
  111.             VII. SUMMARY OF FUNCTIONS................................ 24
  112.             VIII. SPECIFICATIONS AND LIMITATIONS..................... 26
  113.             IX. BUGS................................................. 26
  114.  
  115.                  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                     INTRODUCTION
  137.  
  138.  
  139.  
  140.  
  141.  
  142.             I. INTRODUCTION            I. INTRODUCTION
  143.  
  144.                  LET is a command intended to supplement the DOS command
  145.             SET.  It allows you to assign environment variables in DOS,
  146.             much as SET does, but with significantly more power.  Where-
  147.             as SET only allows literal assignment, such as
  148.  
  149.                             SET COMSPEC=C:\COMMAND.COM
  150.  
  151.             LET actually evaluates what appears to the right of the
  152.             equal sign, instead of merely substituting character-for-
  153.             character what appears there.  LET has available to it a set
  154.             of functions that allow you to perform arithmetic, string
  155.             manipulation, and even rudimentary file reading and data-
  156.             output editing.
  157.  
  158.  
  159.  
  160.             II. BROTHER, CAN YOU SPARE A DIME?            II. BROTHER, CAN YOU SPARE A DIME?
  161.  
  162.                  A lot of work went into LET, and I feel that it is a
  163.             very useful utility, but only you can truly judge how much
  164.             of a benefit it will be to you.  Use it, copy it, give it to
  165.             your friends (unmodified and intact.)  All I ask is that if
  166.             you really find it to be useful, that you help support my
  167.             endeavors by sending a few dollars my way.  I agree with the
  168.             popular opinion that software should be easily accessible,
  169.             that it shouldn't be copy protected, and that it shouldn't
  170.             cost a pound of flesh, but I also agree that those good
  171.             people who put the time into making the product should have
  172.             the right to expect some compensation.  You have Al Kalian,
  173.             sysop of the Palladin BBS, to thank for convincing me not to
  174.             make LET cripple-ware, as was my intent.  I will not resort
  175.             to extortion, but merely ask that if you honestly find this
  176.             program to be useful, please reach in your pocket (or the
  177.             company Petty Cash Fund,) and let me know how much you
  178.             appreciate it.  You need not reach deep, but please make a
  179.             token effort.
  180.  
  181.  
  182.  
  183.             III. OPERATION            III. OPERATION
  184.  
  185.                  With the introduction of DOS version 2.0 came the
  186.             notion of environment variables--named object accessible to
  187.             DOS and the programs run in DOS to which values can be
  188.             assigned.  Some examples of environment variables are
  189.             PROMPT, PATH, and COMSPEC.  The first allows you to
  190.             customize the normal DOS prompt to be nearly anything you
  191.             want, including something like
  192.  
  193.  
  194.  
  195.  
  196.                                          -1-
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                            LET -- (c) Thomas Tuerke, 1987
  203.  
  204.  
  205.                     Your wish is my command, liege:
  206.  
  207.             The second example, PATH, allows you to tell DOS which other
  208.             subdirectories to look in for commands, should they not be
  209.             found in the current directory.  The last example, COMSPEC,
  210.             allows you to tell DOS which command processor to load, and
  211.             in which directory it may be found in.
  212.  
  213.                  All of these variables, and the values associated with
  214.             them, are stored in the environment space.  DOS allows you
  215.             to view and change them, and any other variables you make,
  216.             by means of the SET command.  You may then have programs
  217.             refer to certain environment variables; you may even use
  218.             them in batch files much as you would use parameters.  For
  219.             example, in DOS 3.x, you could easily say
  220.  
  221.                     IF %ANSWER%. == Y. GOTO ABORT_IT
  222.  
  223.             Note: this use of environment variables in batch files is an
  224.             undocumented feature in DOS versions 2.x--care should be
  225.             exercised when using it there.  If a variable does not exist
  226.             in versions 3.x, a null string is substituted, but if it
  227.             does not exist in versions 2.x, the name, sans first percent
  228.             sign, is reinserted.  For example, let us say that the
  229.             variable ANSWER does not exist in the environment space.
  230.             Here is how the two versions of DOS will react:
  231.  
  232.                     DOS 2.x:  IF ANSWER%. == Y. GOTO ABORT_IT
  233.  
  234.                     DOS 3.x:  IF . == Y. GOTO ABORT_IT
  235.  
  236.             Note: a bug in version 3.0 causes the batch file to perform
  237.             incorrectly: characters to the right of the first
  238.             environment variable are lost, so you would get something
  239.             like:
  240.  
  241.                     DOS 3.0  IF Y    (remainder of line is lost)
  242.  
  243.             For this reason, DOS version 3.0 is NOT recommended for use
  244.             with environment variables.
  245.  
  246.                  Like SET, LET assigns values to environment variables.
  247.             If a variable is assigned a value that is null, that is, if
  248.             it contains no characters, then that variable is taken out
  249.             of the environment.  Variables that do not appear in the
  250.             environment automatically have a null value, that is, the
  251.             value is a string of length zero.
  252.  
  253.  
  254.  
  255.             IV. INSTALLATION            IV. INSTALLATION
  256.  
  257.                  LET itself is ready to run and requires no more than
  258.             than to be put into the correct subdirectory or onto the
  259.  
  260.  
  261.  
  262.                                          -2-
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                       OPERATION
  269.  
  270.  
  271.             correct disk.  Since it does deal with the environment
  272.             space, however, you must configure your system to assure
  273.             that you have enough space in the environment--normal DOS
  274.             defaults are sadly undersized.
  275.  
  276.                  Unfortunately, the procedure differs from one version
  277.             of DOS to another.  For versions 2.x installation involves
  278.             patching COMMAND.COM to allow for more space.  See the
  279.             associated files for descriptions on how to increase the
  280.             size of the environment under these versions.
  281.  
  282.                  Happily, the procedure is much simpler in versions 3.1
  283.             and later, although they are still a bit confusing.  For
  284.             these versions of DOS, you need only put an additional line
  285.             in your CONFIG.SYS file, which is to appear in the root
  286.             directory of your booting disk.  The line is
  287.  
  288.                  SHELL=C:\COMMAND.COM /p /e:xxxx
  289.  
  290.             where xxxx is the number of 16-byte paragraphs you want to                  xxxx                                                
  291.             have in DOS 3.1 (62 is the maximum) --OR-- xxxx is the                                                       xxxx       
  292.             number of bytes you want to have in DOS 3.2. (1024 is nice.)
  293.             With 3.2, you can increase this number up to the 32k byte
  294.             limit worth if you need more space.
  295.  
  296.             WARNING: The current version of LET has no idea how much
  297.             space is allotted to the environment, so be liberal if you
  298.             are unsure as to how to much space you will need.  An
  299.             overflow will result in a MEMORY ALLOCATION ERROR, and will
  300.             necessitate a Ctrl-Alt-Del reboot.
  301.  
  302.  
  303.  
  304.             V. SYNTAX            V. SYNTAX
  305.  
  306.                  The syntax for LET is quite simple.  Like SET, it may
  307.             be invoked without any parameters, in which case it will
  308.             report on the state of the environment space.  (It will also
  309.             present a brief help message.)  Alternately, it may be
  310.             invoked with two parameters: the variable to be assigned a
  311.             value, and the value to be assigned to that variable, much
  312.             to the fashion of
  313.  
  314.                             LET variable=value
  315.  
  316.             The nature of the parameter variable is quite straight-                                        variable                   
  317.             forward in that it is merely the name of an environment
  318.             variable, spelled out.  Examples of this might be COMSPEC or
  319.             PATH; the name of the variable may be any sequence of
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.                                          -3-
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                            LET -- (c) Thomas Tuerke, 1987
  335.  
  336.  
  337.             letters, digits, and a few special characters, up to a
  338.             length of 255 characters in all.  The value parameter may                                                  value              
  339.             take one of three forms:
  340.  
  341.                             "literal-constant"
  342.  
  343.                             variable
  344.  
  345.                             (function parameter-list)
  346.  
  347.                  A literal-constant is a string of zero or more                   literal-constant                            
  348.             characters enclosed in quotes and evaluates to the string
  349.             itself.  A string of zero characters is often referred to as
  350.             a null-string.  The command
  351.  
  352.                             LET COMSPEC="D:\COMMAND.COM"
  353.  
  354.             will set the environment variable COMSPEC to the value of
  355.             D:\COMMAND.COM, the characters enclosed in quotes.
  356.  
  357.                  A numeric literal-constant needs not be enclosed in                           literal-constant                         
  358.             quotes.  It may be any integer value between the values of
  359.             positive and negative 99,999,999,999.  That is to say, -2356
  360.             and "-2356" evaluate to the same value, and may be used
  361.             interchangeably (though the former is preferred for
  362.             clarity.)  Non-numeric literals evaluate to a value of zero
  363.             when viewed in numeric constants.  The literal-constant
  364.             "Hi", for example, has a numeric value of zero.
  365.  
  366.                  A variable reference is the name of any environmental                   variable                                           
  367.             variable.  This name may optionally be surrounded by
  368.             percent-signs, such as in %COMSPEC% to emulate the syntax of
  369.             DOS, although this practice is strongly discouraged when
  370.             used with LET unless you know what you are doing.  This form
  371.             of reference evaluates to the value the variable has at the
  372.             time it is evaluated.  If the command
  373.  
  374.                             LET OLDSPEC=COMSPEC
  375.  
  376.             immediately follows the example given above, the variable
  377.             OLDSPEC would also be assigned the value D:\COMMAND.COM.
  378.  
  379.                  Finally, LET has several predefined functions that may
  380.             be referred to in the value parameter, and evaluate to                                  value                           
  381.             values described in detail below.  Most people will find the
  382.             syntax for LET's functions quite unique: the function name
  383.             is typed just inside the left parenthesis to just inside.
  384.             For example, in Lotus 1-2-3 you would say something like
  385.  
  386.                             @PROPER(STRING_FIELD)                             PROPER              
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                                          -4-
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                        SYNTAX
  401.  
  402.  
  403.             and in Pascal or other programming languages you might do
  404.             something similar.  With LET, the syntax is
  405.  
  406.                             (PROPER STRING_FIELD)                             PROPER              
  407.  
  408.             where the function name and the opening parenthesis are
  409.             transposed.  In general, the syntax is
  410.  
  411.                             (function parameter-list)
  412.  
  413.             where function is the name of one of the predefined                  function                                     
  414.             functions in LET, and parameter-list is zero or more items,                                  parameter-list                       
  415.             themselves being either a literal-constant, a variable, or                                      literal-constant    variable    
  416.             another function.  In the example                    function                 
  417.  
  418.                             LET TALLY=(SUM 1 TALLY)
  419.  
  420.             we show a function (SUM), a numeric constant (1), and a                                SUM                                
  421.             variable reference (TALLY).  The result is that TALLY takes                                TALLY                       TALLY      
  422.             on an integer value one greater than it had before.
  423.  
  424.             Note: for those people familiar with the language Lisp, you
  425.             will find that this syntax is fairly similar.  One notable
  426.             exception exists, however: with LET, the first atom in the
  427.             list, the function name, is not evaluated, so it may not be
  428.             an expression.  Only the second parameter and beyond, if
  429.             any, are evaluated.
  430.  
  431.                  To LET, everything is a string of characters, whether
  432.             it is numeric or not.  All functions can accept either
  433.             numeric or non-numeric parameters, although non-numeric
  434.             strings are considered equivalent to zero.  In this way, the
  435.             numeric literal "123456" has six characters in it, although                             123456                                    
  436.             in a numeric context, it has the value of 123,456.  The                                                      123,456      
  437.             literal-constant "Hi" is a string of two characters, and has                              Hi                                        
  438.             a numeric value of zero.
  439.  
  440.                  Function and variable names may be entered in either
  441.             lower or upper case--that is to say, (ADD 1 2 3) is equiva-                                                 (ADD 1 2 3)           
  442.             lent to (add 1 2 3) and (+ 1,TALLY) is equivalent to                    (add 1 2 3)     (+ 1,TALLY)                 
  443.             (+ 1,tally)--so the two cases may be entered inter-            (+ 1,tally)                                        
  444.             changeably.  Characters in literal constants are not altered
  445.             in any way, and are seen by LET exactly as they are typed.                                        LET                           
  446.             Thus "hi" and "HI" are not equivalent constants.  Similarly,                  hi       HI                                                                              ___                                  
  447.             all characters in in constants, function names, and variable
  448.             names, are significant.  "HI" is not equivalent to "HI    "                                      HI                        HI                        ___                                                 
  449.             or "HIGH", nor is the variable VAR the same variable as                HIGH                       VAR                     
  450.             VARIABLE.            VARIABLE 
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                                          -5-
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                            LET -- (c) Thomas Tuerke, 1987
  467.  
  468.  
  469.             VI. FUNCTIONS            VI. FUNCTIONS
  470.  
  471.                  LET has built into it the following functions, which
  472.             may be divided into two categories: arithmetic and string.
  473.             Some functions have more than one name, and these names may
  474.             be used interchangeably to achieve the same result.  For
  475.             example
  476.  
  477.                             (add 1 2 3)
  478.  
  479.             and
  480.  
  481.                             (sum 1 2 3)
  482.  
  483.             are functionally identical, and evaluate to the value 6.
  484.  
  485.  
  486.  
  487.             A. Parameters to Functions            A. Parameters to Functions
  488.  
  489.                  Most functions in LET need parameters to operate upon.
  490.             These parameters are typed in following the name of the
  491.             function, and be enclosed in the same set of matching
  492.             parenthesis.  They need only be separated by spaces, though
  493.             commas, if desired, may be inserted.  Any characters not
  494.             recognized as part of a literal constant, variable, or
  495.             function are considered white space, and are ignored.   Here
  496.             are some examples of parameters to functions.
  497.  
  498.                             (add 1,2,3)
  499.  
  500.                             (words "this" "is" "a" "test")
  501.  
  502.                             (  + 128   (* 10  row ) column )
  503.  
  504.                  Some functions take a variable number of parameters,
  505.             usually consisting of zero or more items.  When this is the
  506.             case, number-list or string-list or similar name-list will                  number-list    string-list                -list     
  507.             appear in the syntax description.
  508.  
  509.  
  510.  
  511.             B. Arithmetic Functions            B. Arithmetic Functions
  512.  
  513.                  Arithmetic functions include the five primary integer
  514.             functions, each of which will be discussed individually
  515.             below.
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                                          -6-
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                       FUNCTIONS
  533.  
  534.  
  535.             1. Add Sum Plus +            1. Add Sum Plus +
  536.  
  537.             Syntax: 
  538.  
  539.                     (add number-list)  or
  540.                     (sum number-list)  or
  541.                     (plus number-list) or
  542.                     (+ number-list)
  543.  
  544.             Description:
  545.  
  546.                  This function will return the sum of the values given
  547.             in number-list.  If number-list has no elements, then this               number-list      number-list                           
  548.             function returns zero.
  549.  
  550.             Examples:
  551.  
  552.             (add 1 2 3) is arithmetically equivalent to 1 + 2 + 3 and            (add 1 2 3)                                              
  553.                  will return 6.
  554.  
  555.             (+ 1,tally) increments the value of tally.  Note that            (+ 1,tally)                         tally            
  556.                  addition is commutative, and this example is equivalent
  557.                  to (+ tally,1).                    (+ tally,1) 
  558.  
  559.  
  560.  
  561.             2. Sub Minus -            2. Sub Minus -
  562.  
  563.             Syntax: 
  564.  
  565.                     (sub number-list)   or
  566.                     (minus number-list) or
  567.                     (- number-list)
  568.  
  569.             Description:
  570.  
  571.                  This function will return the first value in number-                                                              number-
  572.             list less the rest of the values given in number-list.  If            list                                      number-list     
  573.             number-list has no elements, then this function returns            number-list                                            
  574.             zero.
  575.  
  576.             Examples:
  577.  
  578.             (sub 1 2 3) = 1 - 2 - 3 = -4.            (sub 1 2 3)                  
  579.  
  580.             (- tally,1) decrements the value of tally.  Note that            (- tally,1)                         tally            
  581.                  subtraction is not commutative, and this example is not
  582.                  the same as (- 1,tally).                             (- 1,tally) 
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                                          -7-
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                            LET -- (c) Thomas Tuerke, 1987
  599.  
  600.  
  601.             3. Mult Times Product *            3. Mult Times Product *
  602.  
  603.             Syntax: 
  604.  
  605.                     (mult number-list)    or
  606.                     (times number-list)   or
  607.                     (product number-list) or
  608.                     (* number-list)
  609.  
  610.             Description:
  611.  
  612.                  This function will return the product of the elements
  613.             in number-list.  If number-list has no elements, then the               number-list      number-list                          
  614.             result is 1.
  615.  
  616.             Examples:
  617.  
  618.             (product 1 2 3) = 1 * 2 * 3 = 6.            (product 1 2 3)                 
  619.  
  620.             (add 128 (times row 80) col) is arithmetically the same as            (add 128 (times row 80) col)                              
  621.                  the expression 128 + (row * 80) + col.  Notice that one                                128 + (row * 80) + col                  
  622.                  of the parameters to the function add in this example                                                   add                
  623.                  is the function times, demonstrating how more                                 times                        
  624.                  complicated calculations are made.
  625.  
  626.  
  627.  
  628.             4. Div /            4. Div /
  629.  
  630.             Syntax: 
  631.  
  632.                     (div number-list)   or
  633.                     (/ number-list)
  634.  
  635.             Description:
  636.  
  637.                  This function will return the first value in number-                                                              number-
  638.             list divided by the rest of the values given in number-list.            list                                            number-list 
  639.             If number-list has no elements, then this function returns               number-list                                            
  640.             1.  Note that this is integer division--remainders and
  641.             fractions are dropped.  For remainders, see mod hereafter.                                                        mod           
  642.  
  643.             Note: if the second or any successive value in number-list                                                           number-list
  644.             is zero, a division by zero occurs, and div returns the                                                    div            
  645.             value *Division-By-Zero*.                  *Division-By-Zero* 
  646.  
  647.             Examples:
  648.  
  649.             (div 12 5) = 12 / 5 = 2 (not 2.4! Fractions are dropped!)            (div 12 5)          =                                    
  650.  
  651.             (div 12 3 2) = 12 / 3 / 2 = 2.            (div 12 3 2)                  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                                          -8-
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                       FUNCTIONS
  665.  
  666.  
  667.             5. Mod %            5. Mod %
  668.  
  669.             Syntax: 
  670.  
  671.                     (mod number-list)   or
  672.                     (% number-list)
  673.  
  674.             Description:
  675.  
  676.                  This function will return the cumulative remainder of
  677.             first value in number-list divided by the rest of the values                           number-list                                  
  678.             given in number-list.  If number-list has no elements, then                     number-list      number-list                      
  679.             this function returns 1.
  680.  
  681.             Note: if the second or any successive value in number-list                                                           number-list
  682.             is zero, a division by zero occurs, and mod returns the                                                    mod            
  683.             value *Division-By-Zero*.                  *Division-By-Zero* 
  684.  
  685.             Examples:
  686.  
  687.             (mod 14 5) = 14 mod 5 = 4  (14 divided by 5 gives 2, with a            (mod 14 5)                                                 
  688.                  remainder of 4.)
  689.  
  690.  
  691.  
  692.             C. String Functions            C. String Functions
  693.  
  694.                  String functions perform operations on values as a
  695.             string of characters, regardless of whether they are numeric
  696.             or not.  They are enumerated below.
  697.  
  698.  
  699.  
  700.             1. Ascii Asc            1. Ascii Asc
  701.  
  702.             Syntax:
  703.  
  704.                     (ascii string) or
  705.                     (asc string)
  706.  
  707.             Description
  708.  
  709.                  This function takes only one parameter, string, and                                                         string     
  710.             returns the ASCII value of the first character in it,
  711.             otherwise, if the parameter is a null-string, it returns a
  712.             null-string.
  713.  
  714.             Examples:
  715.  
  716.             (ascii "A") returns 65            (ascii "A")           
  717.  
  718.             (asc "longer string") returns 108, which is the ASCII value            (asc "longer string")                                      
  719.                  of the lowercase letter l.                                         l 
  720.  
  721.  
  722.  
  723.  
  724.                                          -9-
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                            LET -- (c) Thomas Tuerke, 1987
  731.  
  732.  
  733.             2. Ask            2. Ask
  734.  
  735.             Syntax:
  736.  
  737.                     (ask prompt delay)  or
  738.                     (ask prompt)        or
  739.                     (ask)
  740.  
  741.             Description:
  742.  
  743.                  This function will display prompt onto the standard                                            prompt                  
  744.             output device, and then accept input from the keyboard.  If
  745.             the delay parameter is specified, ask will wait delay number                delay                                       delay       
  746.             of seconds before automatically terminating the request.
  747.             This number may be an integer between 1 and 65535
  748.             (inclusive.)  This gives you a range of delay times ranging
  749.             from 1 second to well over 18 hours.  If the delay is not                                                         delay       
  750.             specified, the function will wait the maximum time.
  751.  
  752.                  If ask is invoked without either the prompt or delay
  753.             parameters, the prompt defaults to "Yes or No? " and the
  754.             delay time defaults to 65535.
  755.  
  756.             Examples:
  757.  
  758.             (ask "Would you like to start the BBS? " 30) will give you            (ask "Would you like to start the BBS? " 30)              
  759.                  thirty seconds to reply to to the prompt shown.  If you
  760.                  run a bulletin board or some other program from your
  761.                  AUTOEXEC.BAT file, this prompt would allow you to
  762.                  neatly terminate the batch file should decide you want
  763.                  to, yet not jeopardize the system should you leave it
  764.                  unattended.
  765.  
  766.  
  767.  
  768.             3. Char Chr            3. Char Chr
  769.  
  770.             Syntax:
  771.  
  772.                     (char number)  or
  773.                     (chr number)
  774.  
  775.             Description:
  776.  
  777.                  This function generates the ASCII character indicated
  778.             by the value of number.  If the parameter number is omitted                            number                    number           
  779.             then this function returns a null string.
  780.  
  781.                  Note: environment variables are terminated by ASCII
  782.             character 0 (char 0), and therefore this character cannot                        (char 0)                                     
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.                                         -10-
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                       FUNCTIONS
  797.  
  798.  
  799.             occur in the middle of environment variables.  LET permits                                                           LET        
  800.             this function to generate character 0 for the purpose of
  801.             evaluating expressions, but any (char 0)'s remaining in a                                            (char 0)                 
  802.             string when it is placed into the environment are changed to
  803.             spaces (char 32).                   (char 32) 
  804.  
  805.             Examples:
  806.  
  807.             (chr 65) returns the string the capital letter A.            (chr 65)                                         
  808.  
  809.             (char 205) returns one of the IBM ASCII line drawing            (char 205)                                          
  810.                  characters: the horizontal double-line.
  811.  
  812.             LET C=(char 0) will assign (char 32) to C, since a character            LET C=(char 0)                          C                   
  813.                  0 cannot exist in a string.
  814.  
  815.             LET A=(ascii (char 0)) will return the string 0, since LET            LET A=(ascii (char 0))                        0        LET
  816.                  retains character 0 during the evaluation of the
  817.                  expression.
  818.  
  819.  
  820.  
  821.             4. Concat            4. Concat
  822.  
  823.             Syntax:
  824.  
  825.                     (concat string-list)
  826.  
  827.             Description:
  828.  
  829.                  This function concatenates the strings indicated in
  830.             string-list, forming one long string.  Other functions            string-list                                           
  831.             perform concatenation in addition to their normal functions,
  832.             so concat is recommended only for those instances where               concat                                              
  833.             other functions do not provide the concatenation service.
  834.  
  835.             Examples:
  836.  
  837.             (concat "Would you like to run " PROG-NAME "?") will            (concat "Would you like to run " PROG-NAME "?")     
  838.                  concatenate the three strings together.  If PROG-NAME
  839.                  is set to LOTUS.EXE, the result would be
  840.                  
  841.                     Would you like to run LOTUS.EXE?
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                                         -11-
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                            LET -- (c) Thomas Tuerke, 1987
  863.  
  864.  
  865.             5. Dateline            5. Dateline
  866.  
  867.             Syntax:
  868.  
  869.                     (dateline)
  870.  
  871.             Description:
  872.  
  873.                  This function returns today's date, as reported by the
  874.             system clock, in the following format:
  875.  
  876.                     WWW, MMM DD, YYYY, HH:MM XX
  877.                     
  878.  
  879.             where:
  880.  
  881.             WWW (substring positions 1 to 3) is the day of week, such as
  882.                  Sun, Mon, Tue, Wed, Thu, Fri, or Sat.
  883.  
  884.             MMM (substring positions 6 to 8) is the month, such as Jan,
  885.                  Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or
  886.                  Dec.
  887.  
  888.             DD (substring positions 10 to 11) is the day of the month, a
  889.                  number between 1 and 31.  In days numbered 1 through 9,
  890.                  position 10 is a blank.
  891.  
  892.             YYYY (substring positions 14 to 17) is the year, such as
  893.                  1987.
  894.  
  895.             HH (substring positions 20 to 21) is the hour, a number
  896.                  between 1 and 12.  In hours less than 10, position 20
  897.                  is blank.
  898.  
  899.             MM (substring positions 23 to 24) is the minute, a number
  900.                  between 00 and 59.
  901.  
  902.             XX (substring positions 26 to 27) is either "am" or "pm"
  903.                  depending on whether the time is before or after noon.
  904.  
  905.                  Individual parts of the dateline may be extracted using
  906.             the substr function, described hereafter.                substr                               
  907.  
  908.                  Dateline has no parameters.                 Dateline                   
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.                                         -12-
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                       FUNCTIONS
  929.  
  930.  
  931.             6. Do            6. Do
  932.  
  933.             Syntax:
  934.  
  935.                     (do filename)
  936.  
  937.             Description:
  938.  
  939.                  This function opens a file, as determined by filename,                                                              filename 
  940.             and executes variable=value assignments sequentially found                         variable=value                               
  941.             therein, until all statements have been executed.  If
  942.             filename has no extension, an extension of .LET is assumed.            filename                                                   
  943.  
  944.                  The contents of the file must be variable=value                                                  variable=value
  945.             assignments, each on a separate line.  The syntax
  946.             requirements are identical to those of the variable=value
  947.             assignment given on the command line, except that the
  948.             command name LET is omitted.  Here is a possible file:
  949.                  C:\>TYPE SETUP.LET   (the file begins on the next line)
  950.                  ON-TIME=(DATELINE)
  951.                  USER-NAME=(ASK "What's your name? ")
  952.                  PROMPT=(concat "Your Desires, " USER-NAME " $P$G")
  953.             
  954.                  C:\>
  955.  
  956.                  Do may be nested--a do function can appear in a file                 Do                  do                              
  957.             that is opened by another do, but care must be taken not to                                      do                               
  958.             recursively call the same file.
  959.  
  960.                  Regardless of the outcome, do always returns a null                                            do                      
  961.             string.  This means that you will need to invent a dummy
  962.             variable to satisfy LET's syntax requirements, such as
  963.  
  964.                     LET MYDUMMYVAR = (DO "QUERY")
  965.  
  966.                  Note: in future versions, this function may return more
  967.             useful information.
  968.  
  969.             Examples:
  970.  
  971.             LET DUMMY (DO "C:\SETUP") would be the same as issuing the            LET DUMMY (DO "C:\SETUP")                                 
  972.                  commands shown above, one by one, for example:
  973.  
  974.                  LET ON-TIME=(DATELINE)
  975.                  LET USER-NAME=(ASK "What's your name? ")
  976.                  LET PROMPT=(concat "Your Desires, " USER-NAME " $P$G")
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                                         -13-
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                            LET -- (c) Thomas Tuerke, 1987
  995.  
  996.  
  997.             7. Dup            7. Dup
  998.  
  999.             Syntax:
  1000.  
  1001.                     (dup string factor)
  1002.  
  1003.             Description:
  1004.  
  1005.                  This function duplicates string up to factor times,                                          string       factor       
  1006.             subject to the maximum length of a string allowed by LET,
  1007.             and returns this result.  If factor would result in a string                                         factor                         
  1008.             longer than this maximum length, factor is adjusted down to                                             factor                    
  1009.             the highest number possible which will not exceed this
  1010.             limitation.
  1011.  
  1012.             Example:
  1013.  
  1014.             (dup (chr 205) 77) will create a string of length 77,            (dup (chr 205) 77)                                   
  1015.                  consisting of 77 horizontal-double-line (IBM line-
  1016.                  graphic) characters.
  1017.  
  1018.             (concat (chr 201) (dup (chr 205) 77) (chr 187)) will            (concat (chr 201) (dup (chr 205) 77) (chr 187))     
  1019.                  generate the upper edge of a double-bordered box.
  1020.  
  1021.             (dup "....|" 15) will create a ruler-like pattern consisting            (dup "....|" 15)                                            
  1022.                  of fifteen repetitions of the string shown.
  1023.  
  1024.  
  1025.  
  1026.             8. Filespec            8. Filespec
  1027.  
  1028.             Syntax:
  1029.  
  1030.                     (filespec options file-specification)
  1031.  
  1032.             Description:
  1033.  
  1034.                  This very useful function will parse and return desired
  1035.             portions of file-specification, depending on the options                        file-specification                   options
  1036.             desired.  Options may consist of any characters, but                      Options                                   
  1037.             filespec looks specifically for the letters d, p, f, and e            filespec                                                  
  1038.             (in either upper or lower case.)  File-specification may be                                              File-specification       
  1039.             any valid file specification or portion thereof, including
  1040.             but not requiring the drive name, path, file name and
  1041.             extension.
  1042.  
  1043.                  If options includes the letter d, filespec will return                    options                     d  filespec            
  1044.             the drive shown in file-specification, or the current drive                               file-specification                      
  1045.             if none is given.
  1046.  
  1047.                  If options includes the letter p, filespec will return                    options                     p  filespec            
  1048.             the path shown in file-specification.  If that path is                              file-specification                  
  1049.             relative (ie, if it does not start with a backslash,) the
  1050.             current working directory for the drive (as per option d                                                                   d
  1051.  
  1052.  
  1053.  
  1054.                                         -14-
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                       FUNCTIONS
  1061.  
  1062.  
  1063.             above) is included as part of that path--this way, the
  1064.             absolute path is always returned.
  1065.  
  1066.                  If options includes the letter f, filespec will return                    options                     f  filespec            
  1067.             the file name shown in file-specification.                                   file-specification 
  1068.  
  1069.                  If options includes the letter e, filespec will return                    options                     e  filespec            
  1070.             the extension shown in file-specification.                                   file-specification 
  1071.  
  1072.                  Filespec will not check for the existence of the file
  1073.             named in file-specification, but it may attempt to determine
  1074.             the current drive and directory.
  1075.  
  1076.             Examples:
  1077.  
  1078.             (filespec "dpfe" "COMMAND.COM") will return the fully            (filespec "dpfe" "COMMAND.COM")                      
  1079.                  qualified file name, including the drive and path, even
  1080.                  though they are not given in the file-specification.                                                  file-specification 
  1081.                  (They will default to the current drive and the current
  1082.                  directory on that drive.)  If we are on drive C, and in
  1083.                  the directory DOS, filespec will return the string
  1084.                  C:\DOS\COMMAND.COM.  The options "d:\p\f.e" would                 C:\DOS\COMMAND.COM       options "d:\p\f.e"      
  1085.                  result in the same results, since the other characters
  1086.                  are ignored.
  1087.  
  1088.             (filespec "f" WORKFILE) will return the file name (sans            (filespec "f" WORKFILE)                                
  1089.                  drive, path, and extension) of the file specified by
  1090.                  the environment variable WORKFILE.  If WORKFILE is set
  1091.                  to AP0087.WRK, then filespec will return AP0387.                                                          AP0387 
  1092.  
  1093.             By specifying (filespec "d" ""), you may determine the                          (filespec "d" "")                       
  1094.                  current drive.  Similarly, you may determine the
  1095.                  current directory by specifying (filespec "p" "").                                                 (filespec "p" "") 
  1096.                  Furthermore, you may determine the default directory on
  1097.                  any drive (let us say, drive B) by specifying
  1098.                  (filespec "p" "B:").                 (filespec "p" "B:") 
  1099.  
  1100.  
  1101.  
  1102.             9. Fill            9. Fill
  1103.  
  1104.             Syntax:
  1105.  
  1106.                     (fill pattern data filler)  or
  1107.                     (fill pattern data)
  1108.  
  1109.             Description and Examples:
  1110.  
  1111.                  This function allows you to fill data into a format
  1112.             pattern, thus achieving formatted output.  Pattern is a                                                       Pattern     
  1113.             string containing both text and `fill' characters, the
  1114.             latter being replaced by characters from data or filler.                                                     data    filler 
  1115.             Data may be filled either from left to right, or right to
  1116.             left, depending on the fill character used: the symbol ≥                                                                   ≥
  1117.  
  1118.  
  1119.  
  1120.                                         -15-
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                            LET -- (c) Thomas Tuerke, 1987
  1127.  
  1128.  
  1129.             (the greater-than-or-equal symbol, character 242) represents
  1130.             a left to right fill, and ≤ (the less-than-or-equal symbol,                                      ≤                                
  1131.             character 243,) represents a right to left fill.
  1132.  
  1133.                  For left fill, the first left-fill character in pattern                                                                 pattern
  1134.             is replaced by the first character in data, the second left-                                                  data                  
  1135.             fill character in pattern is replaced by the second                              pattern                          
  1136.             character in data, and so on.                         data            
  1137.  
  1138.                  When all the characters in data have been exhausted,                                            data                     
  1139.             fill suppresses the rest of pattern, that is, the remaining                                        pattern                        
  1140.             characters in pattern, (regardless of whether they are fill-                          pattern                                       
  1141.             characters or not,) are replaced by the characters in
  1142.             filler, one by one, until all the characters in filler are            filler                                          filler    
  1143.             exhausted; when this happens, the last filler character is                                                   filler             
  1144.             copied to all remaining positions in pattern.  The resultant                                                 pattern                
  1145.             pattern is returned by fill.                                   fill 
  1146.  
  1147.                  Let us say that we have a pattern of "≥≥≥-≥≥≥≥ x≥≥≥≥",                                           pattern                     
  1148.             data of "3323900640", and a filler of ". "  The following            data                        filler                       
  1149.             will occur:
  1150.  
  1151.                     "3323900640" ". "       (Data and filler)                                             Data     filler 
  1152.             
  1153.                      332 3900  640. 
  1154.                     "≥≥≥-≥≥≥≥ x≥≥≥≥"        (Pattern)                                             Pattern 
  1155.  
  1156.                     "332-3900 x640."        (returned result)
  1157.  
  1158.             Similarly, if data is only "3323900", then we would get the                          data                                         
  1159.             following:
  1160.  
  1161.                     "3323900"   ". "
  1162.             
  1163.                      332 3900.
  1164.                     "≥≥≥-≥≥≥≥ x≥≥≥≥"
  1165.  
  1166.                                             (Once filler has been                                                  filler         
  1167.                                             exhausted--fill has put down                                                       fill             
  1168.                                             a period and the first
  1169.                                             space--fill continues to use                                                   fill                 
  1170.                                             the last character in filler                                                                  filler
  1171.                                             until the end of pattern.)                                                             pattern  
  1172.  
  1173.                     "332-3900.     "
  1174.  
  1175.                  Fill functions very similarly for right fill.  The                 Fill                                              
  1176.             rightmost right-fill character in pattern is substituted by                                              pattern                  
  1177.             the right-most character in data, and fill works                                        data      fill      
  1178.             progressively leftward, until all of data is used; it then                                                 data                 
  1179.             resorts to filler, suppressing all characters from that                       filler                                      
  1180.             point to the left.  When all of filler has been exhausted,                                            filler                    
  1181.             the leftmost character of filler is copied into the                                      filler                   
  1182.             remaining positions.  For example, let us say we have the
  1183.  
  1184.  
  1185.  
  1186.                                         -16-
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                       FUNCTIONS
  1193.  
  1194.  
  1195.             pattern "≤≤≤,≤≤≤,≤≤≤.≤≤" and the data of "123456".  In this            pattern                          data                      
  1196.             instance, let us choose a filler of " $".  This is how fill                                      filler                       fill
  1197.             will behave:
  1198.  
  1199.                       " $" "123456"
  1200.  
  1201.                          $1 234 56
  1202.                     "≤≤,≤≤≤,≤≤≤.≤≤"
  1203.             
  1204.                     "    $1,234.56"
  1205.  
  1206.             We can further exemplify how the last (leftmost) character
  1207.             of filler is propagated through the remaining characters of               filler                                                  
  1208.             the pattern by using a filler of "*$".  In this case, the                pattern            filler                            
  1209.             result is
  1210.  
  1211.                     "****$1,234.56"
  1212.  
  1213.             If you do not want the suppression to take place, merely
  1214.             concatenate a filler string to the correct end of data, to
  1215.             make the length of the data longer than the number of left
  1216.             or right fill characters--characters in data only get put                                                    data             
  1217.             into pattern's fill-characters, but characters in filler are                                                              filler    
  1218.             placed in all remaining characters, suppressing the original
  1219.             pattern.  (This is how the unused commas are suppressed in            pattern                                                   
  1220.             the two right-fill examples.)
  1221.  
  1222.                  Note: in any given pattern, there may only be left-fill
  1223.             characters or right-fill characters, but not both (otherwise
  1224.             it is not clear whether a left or right fill is to take
  1225.             place.)  If you need to fill in both directions, either
  1226.             break up the pattern into two parts (if left and right fills
  1227.             don't overlap) or use a temporary character to represent the
  1228.             undesired fill character while the first fill takes place,
  1229.             and then use the replace function (described below) to                             replace                              
  1230.             change the temporary character into fill characters.
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                                         -17-
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                            LET -- (c) Thomas Tuerke, 1987
  1259.  
  1260.  
  1261.             10. Length Len            10. Length Len
  1262.  
  1263.             Syntax:
  1264.  
  1265.                     (length string-list)  or
  1266.                     (len string-list)
  1267.  
  1268.             Description:
  1269.  
  1270.                  This function determines the length (the total number
  1271.             of characters) found in string-list.  If string-list                                    string-list      string-list
  1272.             consists of more than one string, it will return the
  1273.             cumulative length of the strings, up to the maximum length
  1274.             an environment variable can have.
  1275.  
  1276.             Examples:
  1277.  
  1278.             (length "This is a test") will return 14.            (length "This is a test")                
  1279.  
  1280.             (length "") will return 0.            (length "")               
  1281.  
  1282.             (len "this" "is" "a" "test") will return 11.            (len "this" "is" "a" "test")                
  1283.  
  1284.  
  1285.  
  1286.             11. Lower            11. Lower
  1287.  
  1288.             Syntax:
  1289.  
  1290.                     (lower string-list)
  1291.  
  1292.             Description:
  1293.  
  1294.                  This function will concatenate all the strings in
  1295.             string-list, converting any uppercase letters to lowercase.            string-list                                                
  1296.  
  1297.             Examples:
  1298.  
  1299.             (lower "This is a test") will return "this is a test".            (lower "This is a test")                              
  1300.  
  1301.             (lower "THIS" "is" "a" "TEST") will return "thisisatest".            (lower "THIS" "is" "a" "TEST")                           
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                                         -18-
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                       FUNCTIONS
  1325.  
  1326.  
  1327.             12. Pos            12. Pos
  1328.  
  1329.             Syntax:
  1330.  
  1331.                     (pos source-string search-string start)
  1332.                     (pos source-string search-string)
  1333.  
  1334.             Description:
  1335.  
  1336.                  This function will search source-string, looking for                                           source-string             
  1337.             the first occurrence of search-string.  If a start position                                    search-string        start         
  1338.             is specified, then searching will begin a that position of
  1339.             source-string.  If there is no match found, pos will return            source-string                               pos            
  1340.             a zero.
  1341.  
  1342.             Examples:
  1343.  
  1344.             (pos "This is a test" " ") will return 5.            (pos "This is a test" " ")               
  1345.  
  1346.             (pos "This is a test" " " 6) will return 8, since the search            (pos "This is a test" " " 6)                                
  1347.                  is begun at the sixth character in source-string.                                                    source-string 
  1348.  
  1349.  
  1350.  
  1351.             13. Proper            13. Proper
  1352.  
  1353.             Syntax:
  1354.  
  1355.                     (proper string-list)
  1356.  
  1357.             Description:
  1358.  
  1359.                  This function will capitalize all initial letters in
  1360.             words and reduce to lowercase all other letters found in
  1361.             individual strings of string-list, and concatenate the                                  string-list                     
  1362.             results which are then returned.
  1363.  
  1364.             Examples:
  1365.  
  1366.             (proper "THIS is a TEST") will return "This Is A Test".            (proper "THIS is a TEST")                              
  1367.  
  1368.             (proper "chk" "dsk" ".exe") will return "ChkDsk.Exe".            (proper "chk" "dsk" ".exe")                          
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                                         -19-
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                            LET -- (c) Thomas Tuerke, 1987
  1391.  
  1392.  
  1393.             14. Read            14. Read
  1394.  
  1395.             Syntax:
  1396.  
  1397.                     (read filename position length)
  1398.  
  1399.             Description:
  1400.  
  1401.                  This function will open the file named in filename, and                                                           filename     
  1402.             read up to length characters starting from position in the                       length                          position       
  1403.             file.  A positive value of position is measured in                                       position               
  1404.             characters from the beginning of the file, 0 being the first
  1405.             character, 1 being the second, and so on.  If position is                                                          position   
  1406.             expressed as a negative number, position is measured from
  1407.             the end of file, with -1 being the last character in the
  1408.             file, -2 being the second to last characters, and so on.
  1409.  
  1410.                  If position is greater than the end of file, a null-                    position                                         
  1411.             string will be returned.  If position is negative, but of
  1412.             magnitude greater than the end of file (that is, position
  1413.             would point to a position before the beginning of the file)
  1414.             then position is assumed to be zero--the beginning of the
  1415.             file.
  1416.  
  1417.                  If reading length characters would cause read to go                            length                                  
  1418.             beyond the end of file, only those characters up to the end
  1419.             of file will be returned; in this way read will return a
  1420.             string of zero up to length characters, subject to the                                 length                           
  1421.             maximum number of characters a string can contain.
  1422.  
  1423.                  Note: environment variables are terminated by ASCII
  1424.             character 0 (char 0), and therefore this character cannot                        (char 0)                                     
  1425.             occur in the middle of environment variables.  LET permits                                                           LET        
  1426.             this function to generate character 0 for the purpose of
  1427.             evaluating expressions, but any (char 0)'s remaining in a                                            (char 0)                 
  1428.             string when it is placed into the environment are changed to
  1429.             spaces (char 32).                   (char 32) 
  1430.  
  1431.             Examples:
  1432.  
  1433.             Assuming the command
  1434.                  
  1435.                     C:\>VOL > VOL-NAME.$$$
  1436.                  
  1437.                  has been issued, (read "C:\VOL-NAME.$$$" 24 11) will                                  (read "C:\VOL-NAME.$$$" 24 11)     
  1438.                  return the name of the volume of the current disk
  1439.  
  1440.             Assuming the command
  1441.                  
  1442.                  C:\>DIR > FREE.$$$
  1443.                  
  1444.                  has been issued, (read "C:\FREE.$$$" -23 11) will                                  (read "C:\FREE.$$$" -23 11)     
  1445.                  return the amount of free disk space on drive C.
  1446.  
  1447.  
  1448.  
  1449.  
  1450.                                         -20-
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                       FUNCTIONS
  1457.  
  1458.  
  1459.             15. Replace            15. Replace
  1460.  
  1461.             Syntax:
  1462.  
  1463.                     (replace source-string old new)
  1464.                     (replace source-string old1 new1 old2 new2 ... )
  1465.  
  1466.             Description:
  1467.  
  1468.                  This function will search source-string for any                                           source-string        
  1469.             occurrence of old, and replace it with new.  If there is                          old                      new              
  1470.             more than one old/new pair, this function will successively                          old new                                      
  1471.             replace any occurrences of old2 with new2, old3 with new3,                                       old2      new2  old3      new3 
  1472.             and so on.  It then returns the resultant string.
  1473.  
  1474.             Examples:
  1475.  
  1476.             (replace "This is bad" "bad" "good") will return "This is            (replace "This is bad" "bad" "good")                     
  1477.                  good".
  1478.  
  1479.             (replace (dateline) "Sun" "Sunday" "Mon" "Monday" "Tue"            (replace (dateline) "Sun" "Sunday" "Mon" "Monday" "Tue"
  1480.                  "Tuesday" "Wed" "Wednesday" "Thu" "Thursday" "Fri"                 "Tuesday" "Wed" "Wednesday" "Thu" "Thursday" "Fri"
  1481.                  "Friday" "Sat" "Saturday") will change the dateline to                 "Friday" "Sat" "Saturday")                            
  1482.                  spell out the day of the week.
  1483.  
  1484.             (replace (dateline) "  " " ") will change the dateline to            (replace (dateline) "  " " ")                            
  1485.                  suppress the leading spaces before some numbers, such
  1486.                  as the day of month, and the hour.
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                                         -21-
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                            LET -- (c) Thomas Tuerke, 1987
  1523.  
  1524.  
  1525.             16. Substr Mid            16. Substr Mid
  1526.  
  1527.             Syntax:
  1528.  
  1529.                     (substr source-string position length)  or
  1530.                     (mid source-string position length)     or
  1531.             
  1532.                     (substr source-string position)         or
  1533.                     (mid source-string position)
  1534.  
  1535.             Description:
  1536.  
  1537.                  This function will return the substring, or middle
  1538.             length characters of source-string, starting at position.            length               source-string              position 
  1539.             If position + length would exceed the length of source-               position   length                            source-
  1540.             string, then only as many characters as remain from position            string                                              position
  1541.             to the end will be returned.  If length is omitted, then                                             length                 
  1542.             length is assumed to be the number of characters to copy            length                                                  
  1543.             from position to the end of the string.                 position                          
  1544.  
  1545.             Examples:
  1546.  
  1547.             (substr "Hello there World" 7 5) will return "there".            (substr "Hello there World" 7 5)                     
  1548.  
  1549.             (mid "Hello there World" 7) will return "there World".            (mid "Hello there World" 7)                           
  1550.  
  1551.  
  1552.  
  1553.             17. Trim            17. Trim
  1554.  
  1555.             Syntax:
  1556.  
  1557.                     (trim string-list)
  1558.  
  1559.             Description:
  1560.  
  1561.                  This function will delete leading and trailing blank
  1562.             characters (chr 32) from each string in string-list, and                                                    string-list     
  1563.             then concatenate the results.
  1564.  
  1565.             Example:
  1566.  
  1567.             (trim "     Economy    Model    ") will return the string            (trim "     Economy    Model    ")                       
  1568.                  "Economy    Model"--note that only leading and trailing
  1569.                  blanks are removed.  To remove all blanks, use replace.                                                                replace 
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.                                         -22-
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                       FUNCTIONS
  1589.  
  1590.  
  1591.             18. Upper            18. Upper
  1592.  
  1593.             Syntax:
  1594.  
  1595.                     (upper string-list)
  1596.  
  1597.             Description:
  1598.  
  1599.                  This function will convert all lowercase letters in
  1600.             string-list to uppercase.
  1601.  
  1602.             Example:
  1603.  
  1604.             (upper "c:\dos\chkdsk.com") will return "C:\DOS\CHKDSK.COM"            (upper "c:\dos\chkdsk.com")                                
  1605.  
  1606.  
  1607.  
  1608.             19. Words            19. Words
  1609.  
  1610.             Syntax:
  1611.  
  1612.                     (words string-list)
  1613.  
  1614.             Description:
  1615.  
  1616.                  This function is very similar to concat, except that
  1617.             spaces (chr 32) are concatenated between individual strings
  1618.             in string-list.               string-list 
  1619.  
  1620.             Example:
  1621.  
  1622.             (words "The" "End"  "Is" "Near") will return the string
  1623.                  "The End Is Near"
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                                         -23-
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                            LET -- (c) Thomas Tuerke, 1987
  1655.  
  1656.  
  1657.             VII. SUMMARY OF FUNCTIONS            VII. SUMMARY OF FUNCTIONS
  1658.  
  1659.             (% n1 n2 n3 ... )  ........ modulus n1 mod n2 mod n3 mod ...
  1660.  
  1661.             (* n1 n2 n3 ... )  ........... multiplies n1 * n2 * n3 * ...
  1662.  
  1663.             (+ n1 n2 n3 ... )  ................. adds n1 + n2 + n3 + ...
  1664.  
  1665.             (- n1 n2 n3 ... )  ............ subtracts n1 - n2 - n3 - ...
  1666.  
  1667.             (/ n1 n2 n3 ... )  ...... integer divides n1 / n2 / n3 / ...
  1668.  
  1669.             (add n1 n2 n3 ... )  ............... adds n1 + n2 + n3 + ...
  1670.  
  1671.             (asc str)  ........ returns ascii value of first char in str
  1672.  
  1673.             (ascii str)  ...... returns ascii value of first char in str
  1674.  
  1675.             (ask prompt delay)  ..... prints prompt, waits delay seconds
  1676.                       ....................................... for answer
  1677.  
  1678.             (char num)  .................... returns ascii character num
  1679.  
  1680.             (chr num)  ..................... returns ascii character num
  1681.  
  1682.             (concat s1 s2 s3 ... )  .......... concatenates s1 s2 s3 ...
  1683.  
  1684.             (dateline)........... returns formatted system date and time
  1685.  
  1686.             (div n1 n2 n3 ... )  .... integer divides n1 / n2 / n3 / ...
  1687.  
  1688.             (dup str num)  .................... duplicates str num times
  1689.  
  1690.             (filespec options filename)  .... returns parsed portions of
  1691.                       ................... filename, depending on options
  1692.  
  1693.             (fill pattern data filler)  .............. fills data into a
  1694.                       ................................ formatted pattern
  1695.  
  1696.             (len s1 s2 s3 ... )  ............. concatenates s1 s2 s3 ...
  1697.                       ................................... returns length
  1698.  
  1699.             (length s1 s2 s3 ... )  .......... concatenates s1 s2 s3 ...
  1700.                       ................................... returns length
  1701.  
  1702.             (lower s1 s2 s3 ... )  ... shifts s1 s2 s3 ... to lowercase,
  1703.                       ................................. and concatenates
  1704.  
  1705.             (mid str pos len)  ............... returns substring of str,
  1706.                       ................. starting from pos, for len chars
  1707.  
  1708.             (minus n1 n2 n3 ... )  ........ subtracts n1 - n2 - n3 - ...
  1709.  
  1710.             (mod n1 n2 n3 ... )  ...... modulus n1 mod n2 mod n3 mod ...
  1711.  
  1712.  
  1713.  
  1714.                                         -24-
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                 SUMMARY OF FUNCTIONS
  1721.  
  1722.  
  1723.             (mult n1 n2 n3 ... )  ........ multiplies n1 * n2 * n3 * ...
  1724.  
  1725.             (plus n1 n2 n3 ... )  .............. adds n1 + n2 + n3 + ...
  1726.  
  1727.             (product n1 n2 n3 ... )  ..... multiplies n1 * n2 * n3 * ...
  1728.  
  1729.             (proper s1 s2 s3 ... )  .......... capitalizes s1 s2 s3 ...,
  1730.                       ................................. and concatenates
  1731.  
  1732.             (read file pos len)  ..... reads len chars from position pos
  1733.                       .......................................... of file
  1734.  
  1735.             (replace str o1 n1 o2 n2 ... )  ........... returns str with
  1736.                       ..... o1 replaced with n1, o2 replaced with n2 ...
  1737.  
  1738.             (sub n1 n2 n3 ... )  .......... subtracts n1 - n2 - n3 - ...
  1739.  
  1740.             (substr str pos len)  ............ returns substring of str,
  1741.                       ................. starting from pos, for len chars
  1742.  
  1743.             (sum n1 n2 n3 ... )  ............... adds n1 + n2 + n3 + ...
  1744.  
  1745.             (times n1 n2 n3 ... )  ....... multiplies n1 * n2 * n3 * ...
  1746.  
  1747.             (trim s1 s2 s3 ... )  ......... removes leading and trailing
  1748.                       ......................... blanks from s1 s2 s3 ...
  1749.                       ................................. and concatenates
  1750.  
  1751.             (upper s1 s2 s3 ... )  .... shifts s1 s2 s3 ... to uppercase
  1752.                       ................................. and concatenates
  1753.  
  1754.             (words s1 s2 s3 ... ) .... concatenates s1 " " s2 " " s3 ...
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.                                         -25-
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                            LET -- (c) Thomas Tuerke, 1987
  1787.  
  1788.  
  1789.             VIII. SPECIFICATIONS AND LIMITATIONS            VIII. SPECIFICATIONS AND LIMITATIONS
  1790.             
  1791.                       Operating System................. PC-DOS or MS-DOS
  1792.                       Version of DOS....................... 2.0 or later
  1793.                         ........................... 3.0 NOT RECOMMENDED!
  1794.                       Memory required....................... 64k or more
  1795.             
  1796.                       Maximum Variable name length............ 255 chars
  1797.                       Maximum Value length.................... 255 chars
  1798.                       Characters allowed in variable names............. 
  1799.                         ....................... A-Z (case ignored,) 0-9,
  1800.                         ............. period, plus, minus/dash, asterisk
  1801.                         .................. slash, percent( ), underscore                                                          1             
  1802.                       Maximum number of variables...................... 
  1803.                         .. subject to space set aside for environment( )                                                                      2 
  1804.             
  1805.                       Maximum variable=value line length:                              variable=value             
  1806.                         DOS command line...................... 127 chars
  1807.                         DO command line....................... 255 chars
  1808.  
  1809.  
  1810.  
  1811.             IX. BUGS            IX. BUGS
  1812.             The following bugs have been encountered in LET version 1.1
  1813.  
  1814.             *    In DOS version 3.2 (and quite possibly in other 3.x
  1815.                  versions,) invoking a second level command processor
  1816.                  will cause LET to use an environment space other than
  1817.                  the one used by SET.  Therefore, it is advised that you
  1818.                  use LET carefully when in a second level of the command
  1819.                  processor.  This problem does not exist in DOS versions
  1820.                  2.x, however.
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.             ____________________
  1831.  
  1832.             1  If the percent sign appears in the first and last
  1833.                positions of a name, such as %COMSPEC%, then they are
  1834.                discarded; this is to emulate the syntax used by DOS.
  1835.                This practice is discouraged by LET since certain
  1836.                ambiguities exist.  LET has can substitute environment
  1837.                variables on its own, rather than relying on DOS to do
  1838.                the substitution.
  1839.  
  1840.             2  Up to 32k of space may be set aside for environment
  1841.                variables; techniques for accomplishing this vary
  1842.                depending on your version of DOS.
  1843.  
  1844.  
  1845.  
  1846.                                         -26-
  1847.  
  1848.  
  1849.