Prefix: Difference between revisions
Jump to navigation
Jump to search
no edit summary
Miraheze>Adám Brudzewsky No edit summary |
Miraheze>Marshall No edit summary |
||
Line 1: | Line 1: | ||
A '''prefix''' of a [[vector]] is another vector which is no longer than that vector, and shares all of its leading [[element]]s. In [[leading axis theory]], an array may be considered a prefix of another array of the same rank if the same relation holds with [[major cell]]s in place of elements. The function [[Take]] produces prefixes of its right argument as long as the left argument is no greater than that argument's length ([[Tally]]). A vector is a prefix of another if and only if its [[Reverse]] is a [[suffix]] of that vector's reverse. | A '''prefix''' of a [[vector]] is another vector which is no longer than that vector, and shares all of its leading [[element]]s. In [[leading axis theory]], an array may be considered a prefix of another array of the same rank if the same relation holds with [[major cell]]s in place of elements. Consequently, a prefix is a kind of [[subarray]]. The function [[Take]] produces prefixes of its right argument as long as the left argument is no greater than that argument's length ([[Tally]]). A vector is a prefix of another if and only if its [[Reverse]] is a [[suffix]] of that vector's reverse. | ||
A vector is a prefix of another vector if its length is [[Less than or Equal to]] that vector's length, and every [[element]] in the prefix vector [[match]]es the corresponding element of the other vector (the one at the same [[index]]). This may be tested using [[Take]] and [[Match]]: | A vector is a prefix of another vector if its length is [[Less than or Equal to]] that vector's length, and every [[element]] in the prefix vector [[match]]es the corresponding element of the other vector (the one at the same [[index]]). This may be tested using [[Take]] and [[Match]]: |