Plan Documentation

Text List Plans (Paternova™ v.0.9.9)

A text list is an ordered list of texts. The following functions, or "plans," can be used to create, modify, calculate, read, write, and otherwise manipulate text lists in Paternova.


Get a Text List

These plans create a text list using the information provided by the user.


Custom Text List

Plan to generate a custom text list.

Description

This plan generates a text list based on the specified text list x. The text list parameter can be specified either as a text list expression or as a reference to the output text list in another cell. A text list expression is a comma separated list of text items where a text item may be enclosed in a leading and a preceding single- or double-quotes that are stripped to produce the output text list.

Example

x = {Hello, World!}{Hello,World!}
x = {Hello, '"Quoted "' World!}{Hello,"Quoted " World!}

Fill Text List

Plan to generate a filled text list.

Description

This plan fills a text list of length n with the text items in the text list a. If there are not enough text items available in a, its last text item is used to fill the remainder of the output text list.

Example

n = {5};a = {Hello,World,!}{Hello,World,!,!,!}
n = {1};a = {Hello,World,!}{Hello}

Import From Text File

Plan to import a text list from a text file.

Description

This plan imports a text list from a text file with the given file name. The text items are separated by the specified delimiter where delimiter is a single-character text that may include escape sequences.

Example

file name = {tests\text.txt};delimiter = { }{Texts,need,to,be,refreshed!}
file name = {tests\rows.txt};delimiter = { }{1;2;3;3.14159,2;3,1;-2}

List Database Tables

Plan to list the tables in a database.

Description

This plan generates a list of the available tables in a database. Databases are identified by their connection index as listed in the database manager. This plan opens the database connection if it is not open.

Example

index = {0}{...}

List Database Column

Plan to import a text list from a database column.

Description

This plan imports a text list from a column in database table. Databases are identified by their connection index as listed in the database manager. This plan opens the database connection if it is not open.

Example

This plan opens the database connection if it is not open.

List Database Selection

Plan to import a text list from a database.

Description

This plan imports a text list from the fields generated by a select statement on from a database table. Databases are identified by their connection index as listed in the database manager. This plan opens the database connection if it is not open.

Example

table = {Persons};statement = {* FROM Persons WHERE City = 'Oxford'};index = {0};{...}

Convert Array

Plan to generate a text list from an array.

Description

This plan generates a text list from the array x. The text representation of each value in the array x is copied into a text item to produce the output text list. When specified, the format of the floating-point numbers is controlled by the width and precision parameters.

Example

x = {1,2,3,4,5,6,7}{1,2,3,4,5,6,7}
x = {pi,2,e};width = {8};precision = {3}{ 3.14, 2, 2.72}

Convert Matrix

Plan to generate a text list from a matrix.

Description

This plan generates a text list from the matrix x. The text representation of each row of the matrix x, where elements are separated by a delimiter, is copied into a text item to produce the output text list. When specified, the format of the floating-point numbers is controlled by the width and precision parameters.

Example

x = {1,2,3;4,5,6};delimiter = { | }{1+0I | 2+0I | 3+0I,4+0I | 5+0I | 6+0I}
x = {pi,2;e,-1};delimiter = {;};width = {8};precision = {3}{ 3.14 +0I; 2 +0I, 2.72 +0I; -1 +0I}

Convert Text

Plan to generate a text list from a text.

Description

This plan generates a text list from the text x. The text x is tokenized, either as tokens separated by the specified delimiter or as tokens enclosed by ltag on the left and rtag on the right, to produce the text items in the output text list.

Example

x = {ab;cd;ef};delimiter = {;}{ab,cd,ef}
x = {A tagged list like this: <ab>, and <cd>, and <ef>.};ltag = {<};rtag = {>}{ab,cd,ef}

Convert Texts

Plan to generate a text list from multiple texts.

Description

This plan generates a text list from the texts x0, x1, etc. Each of these text are copied to a text item to produce the output text list.

Example

x0 = {Hello};x1 = {World};x2 = {!}{Hello,World,!}


Rearrange a Text List

These plans produce a text list by rearranging another text list.


Copy Text List

Plan to copy a text list.

Description

This plan copies all the text items in the text list x.

Example

x = {Hello,World,!}{Hello,World,!}

Replicate Text List

Plan to replicate a text list.

Description

This plan replicates the text list x by duplicating each text item m times, and then repeating the resulting text list n times, producing {x[0](m times), x[1](m times),...}(n times).

Example

x = {World,!};m = {2};n = {3}{World,World,!,!,World,World,!,!,World,World,!,!}

Resize Text List From End

Plan to resize a text list from the end.

Description

This plan resizes a copy of text list x to a length of n by either removing text items from the end or filling the end with repeats of the text list a.

Example

x = {Hello,World,!};n = {6};a = {~}{Hello,World,!,~,~,~}
x = {Hello,World,!};n = {2};a = {~}{Hello,World}
x = {Hello,World,!};n = {6};a = {a,b}{Hello,World,!,a,b,a}

Resize Text List From Start

Plan to resize a text list from the beginning.

Description

This plan resizes a copy of text list x to a length of n by either removing text items from the beginning or filling the beginning with repeats of the text list a.

Example

x = {Hello,World,!};n = {6};a = {~}{~,~,~,Hello,World,!}
x = {Hello,World,!};n = {2};a = {~}{World,!}
x = {Hello,World,!};n = {6};a = {a,b}{a,b,a,Hello,World,!}

Reverse Text List

Plan to reverse a text list.

Description

This plan reverses the order of text items in a copy of text list x.

Example

x = {Hello,World,!}{!,World,Hello}

First Text Item

Plan to copy the first text item.

Description

This plan copies the first text item in the text list x.

Example

x = {Hello,World,!}{Hello}

Last Text Item

Plan to copy the last text item.

Description

This plan copies the last text item in the text list x.

Example

x = {Hello,World,!}{!}

Copy Text Items From Start

Plan to copy text items at indices counted from the beginning.

Description

This plan copies the text items at the indices specified by n from the text list x to produce the output text list. The result at index i is a copy of the n[i]-th text item in the text list x, counted from the beginning.

Example

x = {Hello,Wonderful,World,!};n = {2}{World}
x = {Hello,Wonderful,World,!};n = {2,0}{World,Hello}

Copy Text Items From End

Plan to copy text items at indices counted from the end.

Description

This plan copies the text items at the reverse indices specified by n from the text list x to produce the output text list. The result at index i is a copy of the n[i]-th text item in the text list x, counted from the end. Reverse indices traverse the text list in reverse order.

Example

x = {Hello,Wonderful,World,!};n = {2}{Wonderful}
x = {Hello,Wonderful,World,!};n = {2,0}{Wonderful,!}

Remove Text Items From Start

Plan to remove text items at indices counted from the beginning.

Description

This plan removes, from a copy of text list x, the text items at the indices specified by n[k] for each k.

Example

x = {Hello,Wonderful,World,!};n = {2}{Hello,Wonderful,!}
x = {Hello,Wonderful,World,!};n = {2,0}{Wonderful,!}

Remove Text Items From End

Plan to remove text items at indices counted from the end.

Description

This plan removes, from a copy of text list x, the text items at the reverse indices specified by n[k] for each k. Reverse indices traverse the text list in reverse order.

Example

x = {Hello,Wonderful,World,!};n = {2}{Hello,World,!}
x = {Hello,Wonderful,World,!};n = {2,0}{Hello,World}

Keep Ranges From Start

Plan to keep text items in index ranges counted from the beginning.

Description

This plan retains, in a copy of text list x, only the text items at indices that fall within any of the ranges [a[k], b[k]).

Example

x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3}{Hello,World}

Keep Ranges From End

Plan to keep text items in index ranges counted from the end.

Description

This plan retains, in a copy of text list x, only the text items at reverse indices that fall within any of the ranges [a[k], b[k]). Reverse indices traverse the text list in reverse order.

Example

x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3}{Wonderful,!}

Remove Ranges From Start

Plan to remove text items in index ranges counted from the beginning.

Description

This plan removes, from a copy of text list x, the text items at indices that fall within any of the ranges [a[k], b[k]).

Example

x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3}{Wonderful,!}

Remove Ranges From End

Plan to remove text items in index ranges counted from the end.

Description

This plan removes, from a copy of text list x, the text items at reverse indices that fall within any of the ranges [a[k], b[k]). Reverse indices traverse the text list in reverse order.

Example

x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3}{Hello,World}

Insert Text Items From Start

Plan to insert text items at indices counted from the beginning.

Description

This plan inserts N[k] copies of a[k] into a copy of text list x at index p[k] for each k. The last text item in a and the last value in N are used when k is out of bounds.

Example

x = {Hello,Wonderful};p = {2,2};N = {1,2};a = {World,!}{Hello,Wonderful,World,!,!}
x = {Wonderful,!};p = {0,1,2};N = {1};a = {Hello,World,!}{Hello,Wonderful,World,!,!}

Insert Text Items From End

Plan to insert text items at indices counted from the end.

Description

This plan inserts N[k] copies of a[k] into a copy of text list x at reverse index p[k] for each k. The last text item in a and the last value in N are used when k is out of bounds. Reverse indices traverse the text list in reverse order.

Example

x = {Hello,Wonderful};p = {0,0};N = {2,1};a = {!,World}{Hello,Wonderful,World,!,!}
x = {Wonderful,!};p = {0,1,2};N = {1};a = {!,World,Hello}{Hello,Wonderful,World,!,!}

Keep Text Items

Plan to keep text items.

Description

This plan retains, in a copy of text list x, only those text items that are equal to any of the text items in the text list a.

Example

x = {Hello,Wonderful,World,!};a = {!,Hello,~}{Hello,!}
x = {Hello,Wonderful,World,!};a = {lo,Pat,World,!!}{World}

Remove Text Items

Plan to remove text items.

Description

This plan removes, from a copy of text list x, any text items that are equal to any of the text items in the text list a.

Example

x = {Hello,Wonderful,World,!};a = {!,Hello,~}{Wonderful,World}
x = {Hello,Wonderful,World,!};a = {lo,Wonder,World,!!}{Hello,Wonderful,!}

Trim Side Text Items

Plan to trim text items from the ends while equal to given text items.

Description

This plan removes text items from the beginning of a copy of text list x as long as they are equal to any text item in the text list a, and removes text items from the end as long as they are equal to any text item in the text list b.

Example

x = {Hello,Wonderful,World,!};a = {Hello};b = {!}{Wonderful,World}
x = {~~,~~,~~,Hello,Wonderful,World,!,!!};a = {~~,Hello,!,!!};b = {~~,Hello,!,!!}{Wonderful,World}


Rearrange Multiple Text Lists

These plans produce a text list by rearranging multiple text lists.


Conditional Copy

Plan to conditionally copy a text list.

Description

This plan copies the text list x if text list z is not empty; otherwise, it copies the text list y. Note that refresh requests are not propagated to the parameters x, y, and z.

Example

x = {Hello,!};y = {World,!};z = {true}{Hello,!}
x = {Hello,!};y = {World,!};z = {}{World,!}

Stitch

Plan to stitch text lists.

Description

This plan combines copies of the given text lists in the following order: {x0[0],x0[1],...,x1[0],x1[1],...} to produce the output text list.

Example

x0 = {~a,~b};x1 = {Hello,World,!}{~a,~b,Hello,World,!}

Stitch and Repeat

Plan to stitch and replicate text lists.

Description

This plan produces the output text list by copying each of the given text lists m times and then replicating the resulting text list n times. The output is structured as follows: {(x0[0],x0[1],...)(m times),(x1[0],x1[1],...)(m times),...}(n times).

Example

m = {2};n = {3};x0 = {~a,~b};x1 = {_1,_2,_3}{~a,~b,~a,~b,_1,_2,_3,_1,_2,_3, ~a,~b,~a,~b,_1,_2,_3,_1,_2,_3, ~a,~b,~a,~b,_1,_2,_3,_1,_2,_3}

Insert Text Lists From Start

Plan to insert text lists at indices counted from the beginning.

Description

This plan inserts a copy of the text list yk into a copy of text list x at index p[k] for each k. The last text list among the y text lists is used when k is out of bounds.

Example

x = {World,!};p = {0,2};y0 = {Hello};y1 = {??}{Hello,World,!,??}
x = {World};p = {0,1,1,20};y0 = {Hello};y1 = {!};y1 = {?}{Hello,World,!,?,?}

Insert Text Lists From End

Plan to insert text lists at indices counted from the end.

Description

This plan inserts a copy of the text list yk into a copy of text list x at reverse index p[k] for each k. The last text list among the y text lists is used when k is out of bounds. Reverse indices traverse the text list in reverse order.

Example

x = {World,!};p = {2,0};y0 = {Hello};y1 = {??}{Hello,World,!,??}
x = {World};p = {20,0,0,0};y0 = {Hello};y1 = {!};y1 = {?}{Hello,World,?,?,!}

Text Items From Text Lists

Plan to copy text items from text lists.

Description

This plan copies the k-th text item of the n[k]-th text list for each index k, when available.

Example

n = {1};x0 = {~a,~b,~c,~d};x1 = {Hello,World,!}{Hello}
n = {1,0,0};x0 = {~a,~b,~c,~d};x1 = {Hello,World,!}{Hello,~b,~c}


Modify a Text List

These plans produce a text list by modifying another text list.


Set Text Items From Start

Plan to set text items at indices counted from the beginning.

Description

This plan sets, in a copy of text list x, the text item at index n[k] to c[k] for each k. The last text item in c is used when k is out of bounds. If c is not specified, those text items are removed instead.

Example

x = {Hello,Wonderful,World,!};n = {2};c = {~~}{Hello,Wonderful,~~,!}
x = {Hello,Wonderful,World,!};n = {2,0,1};c = {~a,~b}{~b,~b,~a,!}
x = {Hello,Wonderful,World,!};n = {2,0,1};c = {}{!}

Set Text Items From End

Plan to set text items at indices counted from the end.

Description

This plan sets, in a copy of text list x, the text item at reverse index n[k] to c[k] for each k. The last text item in c is used when k is out of bounds. If c is not specified, those text items are removed instead. Reverse indices traverse the text list in reverse order.

Example

x = {Hello,Wonderful,World,!};n = {2};c = {~~}{Hello,~~,World,!}
x = {Hello,Wonderful,World,!};n = {2,0,1};c = {~a,~b}{Hello,~a,~b,~b}
x = {Hello,Wonderful,World,!};n = {2,0,1};c = {}{Hello}

Set Ranges From Start

Plan to set text items in index ranges counted from the beginning.

Description

This plan sets, in a copy of text list x, the text items at indices that fall within the ranges [a[k], b[k]) to c[k] for each k. The last text item in c is used when k is out of bounds. If c is not specified, those text items are removed instead. Similarly, the last values in a and b are used when k is out of bounds.

Example

x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3};c = {~~}{~~,Wonderful,~~,!}
x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3};c = {~a,~b,~c,~d}{~a,Wonderful,~b,!}
x = {Hello,Wonderful,World,!};a = {0,2};b = {1,20};c = {~a,~b,~c,~d}{~a,Wonderful,~b,~b}
x = {Hello,Wonderful,World,!};a = {0,2};b = {1,20};c = {}{Wonderful}

Set Ranges From End

Plan to set text items in index ranges counted from the end.

Description

This plan sets, in a copy of text list x, the text items at reverse indices that fall within the ranges [a[k], b[k]) to c[k] for each k. The last text item in c is used when k is out of bounds. If c is not specified, those text items are removed instead. Similarly, the last values in a and b are used when k is out of bounds. Reverse indices traverse the text list in reverse order.

Example

x = {Hello,~~,World,~~};a = {0,2};b = {1,3};c = {!,Wonderful}{Hello,Wonderful,World,!}
x = {Hello,Wonderful,World,!};a = {0,2};b = {1,3};c = {~a,~b,~c,~d}{Hello,~b,World,~a}
x = {Hello,Wonderful,World,!};a = {0,2};b = {1,20};c = {~a,~b,~c,~d}{~b,~b,World,~a}
x = {Hello,Wonderful,World,!};a = {0,2};b = {1,20};c = {}{World}

Replace Text Items

Plan to replace text items.

Description

This plan replaces, in a copy of text list x, any text items that are equal to a[k] with c[k] for each k. The last text item in c is used when k is out of bounds. If c is not specified, those text items are removed instead.

Example

x = {Hello,Wonderful,World,!};a = {!,Hello};c = {~a,~b}{~b,Wonderful,World,~a}
x = {Hello,Wonderful,World,!};a = {!,Hello};c = {~~}{~~,Wonderful,World,~~}
x = {Hello,Wonderful,World,!};a = {!,Hello};c = {}{Wonderful,World}

Uppercase

Plan to convert to uppercase.

Description

This plan converts the text items in a copy of text list x to uppercase.

Example

x = {Hello,Wonderful,World,!}{HELLO,WONDERFUL,WORLD,!}

Lowercase

Plan to convert to lowercase.

Description

This plan converts the text items in a copy of text list x to lowercase.

Example

x = {Hello,Wonderful,World,!}{hello,wonderful,world,!}


Highlight a Text List

These plans produce a text list by extracting information from another text list.


Count of Text Items

Plan to count text items.

Description

This plan counts the text items in the text list x. The result is the number of text items in x.

Example

x = {Hello,Paternova,World,!}{4}

Count of Text Item Occurrences

Plan to count occurrences of given text items.

Description

This plan counts the number of text items in the text list x that are equal to any of the text items in the text list a. The result is the number of text items in x that match any text item in a.

Example

x = {Hello,Paternova,World,!};a = {World}{1}
x = {Hello,Paternova,World,!};a = {!,World,ll,~a}{2}


Highlight Multiple Text Lists

These plans produce a text list by extracting information from multiple text lists.


Count of Text Lists with Any Occurrences

Plan to count text lists containing any of the given text items.

Description

This plan counts the number of text lists xk that contain at least one text item present in the text list a. The result is the count of text lists among x0, x1, etc. that have at least one text item matching a text item in a.

Example

a = {World}x0 = {Hello,Paternova};x1 = {World,!};{1}
a = {!,World,ll,~a}x0 = {Hello,Paternova};x1 = {World,!};{1}

Count of Text Lists with All Occurrences

Plan to count text lists containing only the given text items.

Description

This plan counts the number of text lists xk that contain only text items present in the text list a. The result is the count of text lists among x0, x1, etc. that have only text items found in a.

Example

a = {World}x0 = {Hello,Paternova};x1 = {World,!};{0}
a = {!,World,ll,~a}x0 = {Hello,Paternova};x1 = {World,!};{1}


Post Text Lists

These plans output text lists without producing any new data.


Export to Text File

Plan to export text lists to a text file.

Description

This plan exports the text lists x0, x1, etc. to a text file with the given file name. The exported text lists are separated by the specified t_delimiter while their text items are separated by the i_delimiter. Both delimiters may include escape sequences. If the append parameter is not empty, the text lists are appended to the end of the file.

Example

file name = {tests\textlist.txt};append = {};i_delimiter = {,};t_delimiter = {\n};x0 = {Hello,World};x1 = {!,!,!}
file name = {tests\textlist.txt};append = {Yes};i_delimiter = { | };t_delimiter = {\n\n};x0 = {Hello,World};x1 = {Again,!}

Insert into Database Row

Plan to insert text lists into a database record by record.

Description

This plan exports the text lists x0, x1, etc. to a database table as new records. The text items in each text list is used to populate the fields of a record. Databases are identified by their connection index as listed in the database manager. This plan opens the database connection if it is not open.

Example

table = {Persons};index = {0};x0 = {0,Tolkien,John,20 Northmoor Road,Oxford};x0 = {1,Pratchett,Terry,Gurston Manor,Salisbury}{...}

Insert into Database Column

Plan to insert a text list into a database as a column.

Description

This plan exports the text list x to a database table to populate a column. Databases are identified by their connection index as listed in the database manager. This plan opens the database connection if it is not open.

Example

x = {143.9,142.0,141.1,141.1};table = {2025-07-11-Mod1};column = {capacity};index = {0};{...}

Export to Console

Plan to export text lists to the standard output stream.

Description

This plan exports the text lists x0, x1, etc. to the standard output stream which is typically the console. The exported text lists are separated by the specified t_delimiter while their text items are separated by the i_delimiter. Both delimiters may include escape sequences.

Example

i_delimiter = {,};t_delimiter = {\n};x0 = {Hello,World};x1 = {!,!,!}
i_delimiter = { | };t_delimiter = {\n\n};x0 = {Hello,World};x1 = {Again,!}