Penlight Function Index
- I(pl.func) instantiate a PE unless it has already been done
- List.range(pl.list) Emulate Python's range(x) function
- List.split(pl.list) split a string using a delimiter
- List:__call(pl.list) can iterate over a list directly
- List:__concat(pl.list) concatenation operator
- List:__eq(pl.list) equality operator ==
- List:__tostring(pl.list) how our list should be rendered as a string
- List:append(pl.list) Add an item to the end of the list
- List:chop(pl.list) Remove a subrange of elements
- List:clear(pl.list) empty the list
- List:concat(pl.list) join a list of strings
- List:contains(pl.list) does this list contain the value?
- List:count(pl.list) Return the number of times value appears in the list
- List:extend(pl.list) Extend the list by appending all the items in the given list
- List:filter(pl.list) create a list of all elements which match a function
- List:foreach(pl.list) call the function for each element of the list
- List:index(pl.list) Return the index in the list of the first item whose value is given
- List:insert(pl.list) Insert an item at a given position
- List:join(pl.list) join the elements of a list using a delimiter
- List:len(pl.list) list:len() is the same as #list
- List:map(pl.list) apply a function to all elements
- List:map2(pl.list) apply a function to elements of two lists
- List:mapm(pl.list) apply a named meethod to all elements
- List:new(pl.list) Create a new list
- List:partition(pl.list) partition a list using a classifier function
- List:pop(pl.list) Remove the item at the given position in the list, and return it
- List:put(pl.list) Insert an item at the begining of the list
- List:reduce(pl.list) 'reduce' a list using a binary function
- List:remove(pl.list) Remove an element given its index
- List:remove_value(pl.list) Remove the first item from the list whose value is given
- List:reverse(pl.list) Reverse the elements of the list, in place
- List:slice(pl.list) Emulate list slicing
- List:slice_assign(pl.list) general slice assignment s[i1:i2] = seq
- List:sort(pl.list) Sort the items of the list, in place
- List:splice(pl.list) Insert a sublist into a list
- List:transform(pl.list) apply a function to all elementss, in-place
- Map:get(pl.class) get a value from the map
- Map:iter(pl.class) return an iterator over all key-value pairs
- Map:keys(pl.class) list of keys
- Map:len(pl.class) size of map
- Map:set(pl.class) put a value into the map
- Map:values(pl.class) list of values
- MultiMap:set(pl.classx) add a new value to a key
- MultiMap:update(pl.classx) update a MultiMap using a table
- OrderedMap:iter(pl.classx) iterate over key-value pairs in order
- OrderedMap:keys(pl.classx) return the keys in order
- OrderedMap:set(pl.classx) set the key's value
- OrderedMap:sort(pl.classx) sort the keys
- OrderedMap:update(pl.classx) update an OrderedMap using a table
- OrderedMap:values(pl.classx) return the values in order
- Set.map(pl.class) map a function over the values of a set
- Set.values(pl.class) get a list of the values in a set
- Set:difference(pl.class) new set with elements in the set that are not in the other (also -)
- Set:intersection(pl.class) intersection of two sets (also *)
- Set:isdisjoint(pl.class) are the sets disjoint? (no elements in common)
- Set:issempty(pl.class) is the set empty?
- Set:issubset(pl.class) is the first set a subset of the second?
- Set:set(pl.class) add a value to a set
- Set:union(pl.class) union of two sets (also +)
- Set:unset(pl.class) remove a value from a set
- Template:indent_substitute(pl.text) substitute values into a template, preserving indentation
- Template:safe_substitute(pl.text) substitute values into a template
- Template:substitute(pl.text) substitute values into a template, throwing an error
- TypedList:append(pl.classx) append a value to the list
- TypedList:extend(pl.classx) extend the list using another list
- TypedList:slice(pl.classx) return a slice of the list
- Var(pl.func) Functional helpers like composition,binding and placeholder expressions
- abspath(pl.path) return an absolute path
- add(pl.operator) add two values +
- alltokens(pl.input) create an iterator over all tokens
- args(pl.utils) take an arbitrary set of arguments and make into a table
- asserteq(pl.test) like assert, except takes two arguments that must be equal
- asserteq2(pl.test) a version of asserteq that takes two pairs of values
- at(pl.stringx) return the 'character' at the index
- basename(pl.path) return the file part of a path
- bind(pl.func) bind the arguments of a function to given values
- bind1(pl.utils) bind the first argument of the function to a value
- call(pl.operator) apply function to some arguments ()
- center(pl.stringx) center-justify s with width w
- choose(pl.utils) return either of two values, depending on a condition
- class(pl.class) create a new class, derived from a given base class
- clear(pl.tablex) clear out the contents of a table
- clonetree(pl.dir) clone a directory tree
- column(pl.array2d) extract a column from the 2D array
- common_prefix(pl.path) return the largest common prefix path of two paths
- compare(pl.tablex) compare two list-like tables using a predicate
- comparenoorder(pl.tablex) compare two tables using a predicate, without regard for element order
- compose(pl.func) create a function which chains two functions
- concat(pl.operator) concatenate two values (either strings or __concat defined)
- copy(pl.tablex) make a shallow copy of a table
- copyfile(pl.dir) copy a file
- count(pl.stringx) count all instances of subtring in string
- count_map(pl.tablex) A table where the key/values are the values and value counts of the table
- create_getter(pl.input) create a function which grabs the next value from a source
- curry(pl.func) bind the first parameter of the function to a value
- dedent(pl.text) dedent a multiline string by removing any initial indent
- deepcompare(pl.tablex) compare two values
- deepcopy(pl.tablex) make a deep copy of a table, recursively copying all the keys and fields
- difference(pl.tablex) a new table which is the difference of two tables
- dirname(pl.path) return the directory part of a path
- div(pl.operator) divide first value by second /
- endswith(pl.stringx) does string end with the given substring?
- eq(pl.operator) returns true if arguments are equal ==
- escape(pl.utils) escape any 'magic' characters in a string
- exists(pl.path) does a path exist?
- expandtabs(pl.stringx) replace all tabs in s with n spaces
- expanduser(pl.path) Replace a starting '~' with the user's home directory
- extension(pl.path) get the extension part of a path
- extract_cols(pl.array2d) extract the specified columns
- extract_rows(pl.array2d) extract the specified rows
- fields(pl.input) parse an input source into fields
- fill(pl.text) format a paragraph so that it fits into a line width
- filter(pl.data) Filter input using a query
- filter(pl.tablex) filter a table's values using a predicate function
- filter(pl.dir) return a list of all files in a list of files which match the pattern
- find(pl.tablex) return the index of a value in a list
- find_if(pl.tablex) return the index of a value in a list using a comparison function
- fnmatch(pl.dir) does the filename match the shell pattern?
- forall(pl.array2d) perform an operation for all values in a 2D array
- foreach(pl.tablex) apply a function to all elements of a table
- foreachi(pl.tablex) apply a function to all elements of a list-like table in order
- fprintf(pl.utils) write an arbitrary number of arguments to a file using a format
- function_arg(pl.utils) process a function argument
- ge(pl.operator) returns true if a is greater or equal to b >=
- getatime(pl.path) Return the time of last access as the number of seconds since the epoch
- getctime(pl.path) Return the system's ctime
- getdirectories(pl.dir) return a list of all subdirectories of the directory
- getfiles(pl.dir) return a list of all files in a directory which match the a shell pattern
- getmtime(pl.path) Return the time of last modification
- getsize(pl.path) return size of a file
- gt(pl.operator) returns true if a is greater than b >
- icopy(pl.tablex) copy an array into another one, resizing the destination if necessary
- imap(pl.tablex) apply a function to all values of a list
- imap2(pl.tablex) apply a function to values from two arrays
- import(pl.func) wrap a table of functions
- import(pl.utils) take a table and 'inject' it into the local namespace
- indent(pl.text) indent a multiline string
- index(pl.operator) get the indexed value from a table []
- index_by(pl.tablex) return a list of all values in a table indexed by another list
- index_map(pl.tablex) create an index map from a list-like table
- insertvalues(pl.tablex) insert values into a table
- instantiate(pl.func) instantiate a PE into an actual function
- is_callable(pl.utils) is the object either a function or a callable object?
- is_type(pl.utils) is the object of the specified type?
- isabs(pl.path) is this an absolute path?
- isalnum(pl.stringx) does s only contain alphanumeric characters?
- isalpha(pl.stringx) does s only contain alphabetic characters?
- isdigit(pl.stringx) does s only contain digits?
- isdir(pl.path) is this a directory?
- isfile(pl.path) is this a file?
- islower(pl.stringx) does s only contain lower case characters?
- isspace(pl.stringx) does s only contain spaces?
- isupper(pl.stringx) does s only contain upper case characters?
- iter(pl.list) Create an iterator over a seqence
- iter(pl.array2d) iterate over all elements in a 2D array, with optional indices
- iter(pl.permute) an iterator over all permutations of the elements of a list
- join(pl.path) return the path resulting from combining the two paths
- join(pl.stringx) concatenate the strings using this string as a delimiter
- keys(pl.tablex) return all the keys of a table in arbitrary order
- land(pl.operator) true if both values evaluate as true (i
- le(pl.operator) returns true if a is less or equal to b <=
- len(pl.operator) returns length of string or table #
- lfind(pl.stringx) find index of first instance of sub in s from the left
- lines(pl.stringx) return an interator over all lines in a string
- lines(pl.config) like io
- ljust(pl.stringx) left-justify s with width w
- lnot(pl.operator) false if value evaluates as true (i
- lor(pl.operator) true if either value evaluate as true (i
- lstrip(pl.stringx) trim any whitespace on the left of s
- lt(pl.operator) returns true if a is less than b <
- makepath(pl.dir) create a directory path
- makeset(pl.tablex) create a set from a list-like table
- map(pl.tablex) apply a function to all values of a table
- map(pl.array2d) map a function over a 2D array
- map2(pl.tablex) apply a function to values from two tables
- map2(pl.array2d) map a function over two arrays
- mapn(pl.tablex) Apply a function to a number of tables
- memoize(pl.utils) 'memoize' a function (cache returned value for next call)
- merge(pl.tablex) combine two tables, either as union or intersection
- mod(pl.operator) modulo; remainder of a divided by b %
- move(pl.tablex) copy an array into another one
- movefile(pl.dir) move a file
- mul(pl.operator) multiply two values *
- neq(pl.operator) returns true if arguments are not equal ~=
- new(pl.tablex) create a new array of specified size with initial value
- new(pl.data) create a new dataset from a table of rows
- nop(pl.operator) the null operation
- normcase(pl.path) Normalize the case of a pathname
- numbers(pl.input) generate a sequence of numbers from a source
- package_path(pl.path) return the full path where a particular Lua module would be found
- pairmap(pl.tablex) call the function with the key and value pairs from a table
- partition(pl.stringx) partition the string using first occurance of a delimiter
- pow(pl.operator) raise first to the power of second ^
- printf(pl.utils) print an arbitrary number of arguments using a format
- product(pl.array2d) cartesian product of two 1d arrays
- query(pl.data) create a query iterator from a select string
- quit(pl.utils) end this program gracefully
- range(pl.array2d) get a slice of a 2D array using spreadsheet range notation
- read(pl.data) read a delimited file in a Lua table
- read(pl.config) read a configuration file into a table
- readfile(pl.utils) return the contents of a file as a string
- readlines(pl.utils) return the contents of a file as a list of lines
- reduce(pl.tablex) 'reduce' a table using a binary function
- reduce2(pl.array2d) reduce a 2D array into a scalar, using two operations
- reduce_cols(pl.array2d) reduce the columns using a function
- reduce_rows(pl.array2d) reduce the rows using a function
- register(pl.func) register a function for use in placeholder expressions
- remove_col(pl.array2d) remove a column from an array
- remove_row(pl.array2d) remove a row from an array
- removevalues(pl.tablex) remove a range of values from a table
- replace(pl.stringx) replace up to n instances of old by new in the string s
- repr(pl.func) create a string representation of a placeholder expression
- rfind(pl.stringx) find index of first instance of sub in s from the right
- rjust(pl.stringx) right-justify s with width w
- rmtree(pl.dir) remove a whole directory tree
- rpartition(pl.stringx) partition the string p using last occurance of a delimiter
- rstrip(pl.stringx) trim any whitespace on the right of s
- set(pl.array2d) set a specified range of an array to a value
- set(pl.tablex) set an array range to a value
- size(pl.tablex) total number of elements in this table
- slice(pl.array2d) get a slice of a 2D array
- split(pl.utils) - split a string into a list of strings separated by a delimiter
- split(pl.stringx) split a string into a list of strings using a pattern
- splitext(pl.path) given a path, return the root part and the extension part
- splitl(pl.utils) split a string into a list of strings separated by either spaces or commas
- splitpath(pl.path) given a path, return the directory part and a file part
- splitv(pl.stringx) split a string using a pattern
- splitv(pl.utils) split a string into a number of values
- startswith(pl.stringx) does string start with the substring?
- strip(pl.stringx) trim any whitespace on both left and right of s
- sub(pl.operator) subtract b from a -
- swap_cols(pl.array2d) swap two columns of an array
- swap_rows(pl.array2d) swap two rows of an array
- table(pl.permute) construct a table containing all the permutations of a list
- table(pl.operator) make a table from the arguments
- tail(pl.func) all elements of a table except the first
- timer(pl.test) Time a function
- tmpname(pl.path) Return a suitable full path to a new temporary file name
- transform(pl.tablex) apply a function to all values of a list, in-place
- unm(pl.operator) return the negative of a value -
- update(pl.tablex) copy a table into another, in-place
- values(pl.tablex) return all the values of the table in arbitrary order
- words(pl.input) generate a sequence of words from a source
- wrap(pl.text) format a paragraph into lines so that they fit into a line width
- write(pl.array2d) write a 2D array to a file
- writefile(pl.utils) write a string to a file
- zip(pl.tablex) return a table where each element is a table of the ith values of an arbitrary