String comparison: Difference between revisions

→‎{{header|Bracmat}}: Added more explanation
(→‎{{header|Bracmat}}: Added more explanation)
Line 96:
 
=={{header|Bracmat}}==
String comparison in Bracmat is performed by string pattern matching using an atomic pattern. Bracmat has two pattern matching regimes. Originally, pattern matching was only done on tree structures, with patterns mimicking the subject tree to match. Later string pattern matching was introduced. String pattern matching is discernible from the original pattern matching by the prefix <code>@</code>. String pattern matching requires that the subject is atomic. Patterns for string matching can be as complex as patterns used for matching structures. String comparison is a very simple string pattern matching operation requiring just an atomic pattern, combined with some prefixes if needed.
String comparison in Bracmat is performed by pattern matching using an atomic pattern.
The atomic pattern can be prefixed with <code>&lt;</code> (less than), <code>&gt;</code> (greater than), <code>~</code> (not) or <code>%</code> (coerces string matching) or combinations thereof. If both sides of the match operator <code>:</code> are numbers, Bracmat does a numerice comparison, unless the pattern (the rhs) has the prefix <code>%</code>.
<lang bracmat>( {Comparing two strings for exact equality}
& ( ( @(abc:abc)
483

edits