Reference: Expression operators

You need to learn how to use the weaving pattern language expression operators to effectively draft a weave pattern.

The Weaving Pattern Expression Language is designed around a group of values, called the domain of the pattern. For the warp or weft sequences, the domain is made up of the numbers 1 through 8, which correspond to the harnesses and treadles in the tie-up.

Patterns wrap around on their domain so the number one higher than 8 is actually 1, and the number one lower than 1 is actually 8. This is called modular arithmetic. For example, some are found in the sequences 5678123 or 3218765.

The following table defines a few commonly used terms.

 

BLOCK

 

The left operand is a sequence of any length. The right operand is a pattern of digit characters for specifying block lengths from 0 to 9.

If either operand is shorter than the other, it is extended (via repeating) to exactly the length of the other operand.

Then, with equal length operands, each element of the left operand is repeated individually by the value of the corresponding digit in the right operand.

The length of the expansion is the sum of the digits in the (possibly lengthened) right operand.

Individual elements of the right operand (lengths) can be replaced by {number} for counts from 1 to 127.

 

Block Expressions

Block expressions may be used in an interleaved format. This is particularly useful for color sequences like those used in the Scottish tartan plaids. For example, one of the Drummond color sequences is expressed as follows:

[G 8 R 2 G 2 R 56 G 16 B 2 G 2 B 2 G 36 R 2 G 2 R 8|].

REPEAT

 

The left operand is a pattern of any length. The right operand is an integer count. The expansion is the <pattern> repeated <count> times.

 

EXTEND

 

The left operand is a pattern of any length. The right operand is an integer that is interpreted as a length. The left operand is reshaped to be the length as specified by the right operand. If the left operand is shorter that the desired length, it is repeated out to the right length. If the left operand is shorter, it is merely trimmed.

 

CONCAT

 

The left and right operands are both patterns of any length. The result is the left operand concatenated with the right operand. Note that when a pattern is spelled out (e.g. 1234), the concat operation is implicit between each of its members (i.e. 1234 is equivalent to 1,2,3,4). The concat operator is used only when needed — for example, to separate parenthetical operands.

 

INTERLEAVE

 

The left and right operands are both patterns of any length. If either operand is shorter than the other, it is extended (via repeating) to exactly the length of the other operand. Then, the operands are interleaved. Interleaving alternates the elements of the left operand with the elements of the right (like lacing your fingers together). The expansion contains the first element of the left, the first element of the right, the second element of the left, the second element of the right, and so on.

 

UPTO

 

The"-" may be used as an upto operator only when the last element of the left operand is strictly less than the first element of the right operand.

The left and right operands are both patterns of any length.

The expansion is the left operand concatenated with the sequence between the last element of the left operand and the first element of the right operand, concatenated with the rest of the right operand.

Upto wraps around on the domain. For example, 7 upto 2 expands to 7812.

The upto operator may be followed immediately (with no intervening characters) by any number of tick marks ( ' ). A tick mark indicates to cycle through the domain before running up to the right operand. The number of tick marks sets the number of cycles.

 

DOWNTO

 

Operator usage: <pattern> downto <pattern> Short form: >, -

The "-" may be used as an downto operator only when the last element of the left operand is strictly greater than the first element of the right operand.

The left and right operands are both patterns of any length.

The expansion is the left operand concatenated with the descending sequence between the last element of the left operand and the first element of the right operand, concatenated with the rest of the right operand.

Downto wraps around on the domain. For example, 2 downto 7 expands to 2187.

The downto operator may be followed immediately (with no intervening characters) by any number of tick marks ( ' ). A tick mark indicates to cycle through the domain before running down to the right operand. The number of tick marks sets the number of cycles.

 

TEMPLATE

 

The right and left operands are patterns of any length.

Template allows texturing (sub-articulation) of a master pattern (the left operand) with a texture pattern (the right operand).

The first element of the template is taken as the root. All other elements in the template sequence are considered with respect to their difference from the root. For example, if 342 is the template pattern, the first element (3) is the root (r). The second element (4) is r+1, and the third element (2) is r-1. The template is then r, r+1, r-1.

This template is then applied to each element in the left operand, with the element’s value replacing the root.

Remember that the values wrap around on the domain.

 

PALINDROME

 

This operator takes only one operand, the left operand. That operand can be a pattern of any length. The resultant expansion is the left operand concatenated with itself backwards.

However, the center element is not repeated, and the last element of the result is dropped automatically. This is essential when the palindromed sequence is repeated and helps to remove flaws from a weaving draft.

A palindrome word is the same, spelled backwards or forwards, like "madam."

 

PERMUTE

 

The left operand is a pattern of any length. The right operand is a permutation vector.

The left operand is extended to a length that is an integer multiple of the right operand's length.

Then the left operand is permuted in chunks of the right operand's length. The organization of the permutation pattern is used to reorganize the elements in each chunk of the pattern.

For example, a permutation of 312 puts "the third element first, the first element second and the second element third."

 

PBOX

 

The left operand is a pattern of any length. The right operand is a permutation vector. Its length will be adjusted, if necessary, (by trimming or repeating) to equal the length of the left operand.

Then, the organization of the permutation pattern is used to reorganize the elements of the pattern.

Pbox maintains the length of the left operand pattern.

 

UPDOWN

 

The left and right operands are both patterns of any length. If either operand is shorter than the other, it is extended (via repeating) to exactly the length of the other operand.

Then, UPDOWN generates alternating ascending and descending runs. An odd number of runs is always generated. The expansion contains the ascending run from the first element of the left operand to the first element of the right operand, followed by the descending run from there to the second element of the first operand, etc. The operation is complete with the ascending run from the last element of the left operand to the last element of the right operand.

The updown operator may be followed immediately (with no intervening characters) by any number of tick marks ( ' ). A tick mark indicates to cycle through the domain before completing the up and down runs. The number of tick marks sets the number of cycles.

 

DOWNUP

 

The left and right operands are both patterns of any length. If either operand is shorter than the other, it is extended (via repeating) to exactly the length of the other operand.

Then, DOWNUP generates alternating descending and ascending runs. An odd number of runs is always generated. The expansion contains the descending run from the first element of the left operand to the first element of the right operand, followed by the ascending run from there to the second element of the first operand, etc. The operation is complete with the descending run from the last element of the left operand to the last element of the right operand.

The downup operator may be followed immediately (with no intervening characters) by any number of tick marks ( ' ). A tick mark indicates to cycle through the domain before completing the up and down runs. The number of tick marks sets the number of cycles.

 

ROTATE

 

The left operand is a pattern of any length. The right operand is an integer (which may be negative) that is interpreted as a length. Rotate takes the set of elements specified by <number> from the start of the pattern and moves them to the end. A negative number takes a set of elements from the end of the pattern and moves them to the beginning.

 

REVERSE

 

This operator takes only one operand, the left operand. That operand may be a pattern of any length. The resulting expansion is the left operand written backwards.

 

Precedence Ordering

When several operators are used in an expression, they are evaluated in order of precedence. That is, some operations are performed before others. The precedence levels for the pattern language are shown in the following:

When two operators have the same precedence, left to right ordering is followed.

 


Feedback
Was this page helpful? Send feedback. (Internet connection required.)

Copyright 2016 Corel Corporation. All rights reserved.