Documentation for Module: std.lsp ||  Module Index

module: std.lsp
author: Tim Johnson, tim@johnsons-web.com
version: 0.1
description: Global Functions and constants

Global Index
Global Constants either ltrim parseint rtrims
aligned? even? ltrims pass rtrims
cd filesize merge path-add second
cgi? fourth mold path-chop srand
clear halt mrk putb third
compose inspect MTime pwd trim-thru
data? ls pad rm type

Global function documentation

Function: !Global ConstantsTopGlobals IndexNext
    (Global Constants) - Protected
    lc-chars: Lower-case alphabetic characters
    uc-chars: Upper-case alphabetic characters
    alpha: Upper and lower case characters
    alphanum: Upper/lower case characters and numerics
Function: aligned?TopGlobals IndexBackNext
    (aligned? 12 3) => true, (aligned? 12 5) => nil
    Returns if v is evenly divisible by n
Function: cdTopGlobals IndexBackNext
    (cd <str-path>) => Change directory to <str-path>
Function: cgi?TopGlobals IndexBackNext
    syntax: (cgi?) Are we in a cgi environment?
Function: clearTopGlobals IndexBackNext
    (clear val) => "" (if val is string) => () (If val is list)
    Argument: <list-or-string> Remember to quote
    Note!: This is a destructive function.
Function: composeTopGlobals IndexBackNext
    (compose <lst-l> <sep=" ">)
    Takes a list, converts members to strings, evaluating only
    When preceded by a , and joins with a seperator.
Function: data?TopGlobals IndexBackNext
    (data? ()) => nil, (data? "yes") => true
    Does argument have any meaningful data?
Function: eitherTopGlobals IndexBackNext
    (either <condition> <true-clause> else <false-clause>)
    If condition is true, evaluates all expression up to else
    If condition is false,evaluates all expressions following else
    WARNING!: Using in loops can cause great performance penalties,
    if is at least 16 times faster
Function: even?TopGlobals IndexBackNext
    (even? 4) => true, (even? 5) => nil
    Is argument evenly divisible by 2
Function: filesizeTopGlobals IndexBackNext
    (filesize "myfile.txt") => <int-size-of-file>
    Get the size of the file
Function: fourthTopGlobals IndexBackNext
    (fourth (1 2 3 4)) => 4
    returns fourth element
Function: haltTopGlobals IndexBackNext
    (halt <str-optional>)
     (exit) and if needed, leave a message
Function: inspectTopGlobals IndexBackNext
    syntax: (inspect <context-obj>)
    Print out names and values of context members
Function: lsTopGlobals IndexBackNext
    (ls <the current directory>)
    Args:: "*" - find any substring
          "$" - substring at end
          "^" - substring at beginning
          nil - all of directory
Function: ltrimTopGlobals IndexBackNext
    (ltrim <str-target> <str-charstrimmed>)
     shortcut for (trim target of whitespace at beginning)
Function: ltrimsTopGlobals IndexBackNext
    syntax: (ltrims <str-target> <str-removed>)
    example:
    (ltrims "onething" "one") => "thing"
Function: mergeTopGlobals IndexBackNext
    syntax: (merge <lst-1> <lst-2> <lst...n>)
    Description:: Interweave two lists
    Example:
    (merge (1 2 3) ("one" "two" "three")) => ((1 "one")(2 "two")(3 "three"))
Function: moldTopGlobals IndexBackNext
    param: (mold s) converts a symbol to a string and removes context prefix
Function: mrkTopGlobals IndexBackNext
    (mrk <str-may-be-empty>)
     Just an obvious mark
Function: MTimeTopGlobals IndexBackNext
    (MTime "myfile.txt") => <int-modification-time>
    param: <str-filename> - name of file. required
    param: <sym-mode> - one of: seconds, minutes, hours, days
      with mode parameter, calculate time since last modification
    default:: seconds
Function: padTopGlobals IndexBackNext
    syntax: (pad <lst-src> <int-length> <optional-any-val>)
    usage: "pads" list with items up to length, if not val, pad with nils
Function: parseintTopGlobals IndexBackNext
    syntax: (parseint "abc123.txt") => 123
    return: First embedded integer or nil
Function: passTopGlobals IndexBackNext
    (pass) Simply do nothing. Good for readability
Function: path-addTopGlobals IndexBackNext
    (path-add <str-path> <str-added>)
    Extend a path resolving beginning and ending forward slashes
Function: path-chopTopGlobals IndexBackNext
    syntax: (path-chop <str-path>). Remove last segment of a path
    example:
    (chop-path "/one/two/three") => "/one/two"
Function: putbTopGlobals IndexBackNext
    syntax: (putb "onemorething" "more") => "one" and returns "thing"
    <str> String to print
    <break-point> Substring to print _TO_
    Return If break-point is found, substring following or nil
Function: pwdTopGlobals IndexBackNext
    syntax: (pwd) => get the current directory
Function: rmTopGlobals IndexBackNext
    syntax: (rm filename) => delete <str filename> unix only
    Delete the file
Function: rtrimsTopGlobals IndexBackNext
    (rtrims "onething" "thing") => "one"
    returns first argument with second arg removed from end
    (rtrims "one ") => "one"
    Returns argument trimmed of whitespaces from end
Function: rtrimsTopGlobals IndexBackNext
    (rtrims "onething" "thing") => "one"
    returns first argument with second arg removed from end
    (rtrims "one ") => "one"
    Returns argument trimmed of whitespaces from end
Function: secondTopGlobals IndexBackNext
    (second (1 2)) => 2
    Return second element
Function: srandTopGlobals IndexBackNext
    syntax: (srand 8 "abcdefghijklmnopqrstuvwxyz") => string of 8 random chars
    First argument <number> Length of random string
    Second argument <chars> Optional. Source string, default is alpha string of upper and lower case chars
    return: Random string of length num
Function: thirdTopGlobals IndexBackNext
    (third (1 2 3)) => 3
    Return 3rd element
Function: trim-thruTopGlobals IndexBackNext
    syntax: (trim-thru target src)
    arguments: <str-target> substring to find <str-src> source string
    If target found, substring following target, else original string
    example::
    (trim-thru "@" "tim@johnsons-web.com") => "johnsons-web.com"
Function: typeTopGlobals IndexBack
    syntax: (type x) => datatype of x
    From http://www.alh.net/newlisp/phpbb/viewtopic.php?t=2345
    Return a human-readable string describing datatype

Global function documentation