Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
102
Task/String-comparison/Bracmat/string-comparison.bracmat
Normal file
102
Task/String-comparison/Bracmat/string-comparison.bracmat
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
( {Comparing two strings for exact equality}
|
||||
& ( ( @(abc:abc)
|
||||
& @(123:%123)
|
||||
{Previous pairs of strings are exactly equal}
|
||||
)
|
||||
& ( @(abc:Abc)
|
||||
| @(123:%246/2)
|
||||
| @(abc:ab)
|
||||
| @(123:%12)
|
||||
| {Previous pairs of strings are not exactly equal}
|
||||
)
|
||||
)
|
||||
{Comparing two strings for inequality (i.e., the inverse of exact equality)}
|
||||
& ( ( @(abc:~<>abc)
|
||||
& @(abc:~<>Abc)
|
||||
{Previous pairs of strings are more or less equal}
|
||||
)
|
||||
& ( @(abc:~<>ab)
|
||||
| {Previous pairs of strings are not more or less equal}
|
||||
)
|
||||
)
|
||||
{Comparing two strings to see if one is lexically ordered before than the other}
|
||||
& ( ( @(Abc:<abc)
|
||||
& @(Abc:<a)
|
||||
& @(123:<%246/2)
|
||||
& @(123:<%2)
|
||||
& @(12:<%123)
|
||||
& @(ab:<abc)
|
||||
{Previous pairs of strings are lexically ordered one before the other}
|
||||
)
|
||||
& ( @(abc:<abc)
|
||||
| @(abc:<Abc)
|
||||
| @(246/2:<%123)
|
||||
| @(abc:<ab)
|
||||
| @(123:<%12)
|
||||
| @(123:<%123)
|
||||
| {Previous pairs of strings are not lexically ordered one before the other}
|
||||
)
|
||||
)
|
||||
{Comparing two strings to see if one is lexically ordered after than the other}
|
||||
& ( ( @(abc:>Abc)
|
||||
& @(a:>Abc)
|
||||
& @(246/2:>%123)
|
||||
& @(2:>%123)
|
||||
& @(123:>%12)
|
||||
& @(abc:>ab)
|
||||
{Previous pairs of strings are lexically ordered one after the other}
|
||||
)
|
||||
& ( @(abc:>abc)
|
||||
| @(Abc:>abc)
|
||||
| @(123:>%246/2)
|
||||
| @(ab:>abc)
|
||||
| @(12:>%123)
|
||||
| @(123:>%123)
|
||||
| {Previous pairs of strings are not lexically ordered one after the other}
|
||||
)
|
||||
)
|
||||
{How to achieve both case sensitive comparisons and case insensitive comparisons within
|
||||
the language}
|
||||
& ( ( @(abc:~<>abc)
|
||||
& @(abc:~<>Abc)
|
||||
& @(БЪЛГАРСКИ:~<>български)
|
||||
{Previous pairs of strings are more or less equal}
|
||||
)
|
||||
& ( @(abc:~<>ab)
|
||||
| {Previous pairs of strings are not more or less equal}
|
||||
)
|
||||
)
|
||||
{How the language handles comparison of numeric strings if these are not treated lexically}
|
||||
& ( ( @(246/2:123)
|
||||
& @(2:<123)
|
||||
& @(123:>12)
|
||||
& @(123:246/2)
|
||||
& @(12:<123)
|
||||
{Previous numeric string comparisons succeed}
|
||||
)
|
||||
& ( @(123:<246/2)
|
||||
| @(12:>123)
|
||||
| @(123:>123)
|
||||
| @(123:~123)
|
||||
| {Previous numeric string comparisons fail}
|
||||
)
|
||||
)
|
||||
{Demonstrate any other kinds of string comparisons that the language provides, particularly
|
||||
as it relates to your type system. For example, you might demonstrate the difference between
|
||||
generic/polymorphic comparison and coercive/allomorphic comparison if your language supports
|
||||
such a distinction.}
|
||||
& ( ( @(246/2:>12--3)
|
||||
& @(2:>123kg)
|
||||
& @(123:<12d)
|
||||
& @(123:~24/6/2)
|
||||
& @(12a:>123)
|
||||
{Previous coercive string comparisons succeed}
|
||||
)
|
||||
& ( @(2013-05-01:20130501)
|
||||
| @(246/2a:123a)
|
||||
| @(1239:<123-)
|
||||
| {Previous coercive string comparisons fail}
|
||||
)
|
||||
)
|
||||
& done
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue