@@ -327,9 +327,6 @@ class ReplaceAll(BinaryOperator):
327327 >> ReplaceAll[{a -> 1}][{a, b}]
328328 = {1, b}
329329
330- #> a + b /. x_ + y_ -> {x, y}
331- = {a, b}
332-
333330 ReplaceAll replaces the shallowest levels first:
334331 >> ReplaceAll[x[1], {x[1] -> y, 1 -> 2}]
335332 = y
@@ -761,9 +758,6 @@ class Alternatives(BinaryOperator, PatternObject):
761758 Alternatives can also be used for string expressions
762759 >> StringReplace["0123 3210", "1" | "2" -> "X"]
763760 = 0XX3 3XX0
764-
765- #> StringReplace["h1d9a f483", DigitCharacter | WhitespaceCharacter -> ""]
766- = hdaf
767761 """
768762
769763 arg_counts = None
@@ -829,9 +823,6 @@ class Except(PatternObject):
829823 Except can also be used for string expressions:
830824 >> StringReplace["Hello world!", Except[LetterCharacter] -> ""]
831825 = Helloworld
832-
833- #> StringReplace["abc DEF 123!", Except[LetterCharacter, WordCharacter] -> "0"]
834- = abc DEF 000!
835826 """
836827
837828 arg_counts = [1 , 2 ]
@@ -1091,15 +1082,6 @@ class Optional(BinaryOperator, PatternObject):
10911082 >> Default[h, k_] := k
10921083 >> h[a] /. h[x_, y_.] -> {x, y}
10931084 = {a, 2}
1094-
1095- #> a:b:c
1096- = a : b : c
1097- #> FullForm[a:b:c]
1098- = Optional[Pattern[a, b], c]
1099- #> (a:b):c
1100- = a : b : c
1101- #> a:(b:c)
1102- = a : (b : c)
11031085 """
11041086
11051087 arg_counts = [1 , 2 ]
@@ -1235,9 +1217,6 @@ class Blank(_Blank):
12351217 'Blank' only matches a single expression:
12361218 >> MatchQ[f[1, 2], f[_]]
12371219 = False
1238-
1239- #> StringReplace["hello world!", _ -> "x"]
1240- = xxxxxxxxxxxx
12411220 """
12421221
12431222 rules = {
@@ -1293,14 +1272,6 @@ class BlankSequence(_Blank):
12931272 'Sequence' object:
12941273 >> f[1, 2, 3] /. f[x__] -> x
12951274 = Sequence[1, 2, 3]
1296-
1297- #> f[a, b, c, d] /. f[x__, c, y__] -> {{x},{y}}
1298- = {{a, b}, {d}}
1299- #> a + b + c + d /. Plus[x__, c] -> {x}
1300- = {a, b, d}
1301-
1302- #> StringReplace[{"ab", "abc", "abcd"}, "b" ~~ __ -> "x"]
1303- = {ab, ax, ax}
13041275 """
13051276
13061277 rules = {
@@ -1350,21 +1321,6 @@ class BlankNullSequence(_Blank):
13501321 empty sequence:
13511322 >> MatchQ[f[], f[___]]
13521323 = True
1353-
1354- ## This test hits infinite recursion
1355- ##
1356- ##The value captured by a named 'BlankNullSequence' pattern is a
1357- ##'Sequence' object, which can have no elements:
1358- ##>> f[] /. f[x___] -> x
1359- ## = Sequence[]
1360-
1361- #> ___symbol
1362- = ___symbol
1363- #> ___symbol //FullForm
1364- = BlankNullSequence[symbol]
1365-
1366- #> StringReplace[{"ab", "abc", "abcd"}, "b" ~~ ___ -> "x"]
1367- = {ax, ax, ax}
13681324 """
13691325
13701326 rules = {
@@ -1414,16 +1370,6 @@ class Repeated(PostfixOperator, PatternObject):
14141370 = {{}, a, {a, b}, a, {a, a, a, a}}
14151371 >> f[x, 0, 0, 0] /. f[x, s:0..] -> s
14161372 = Sequence[0, 0, 0]
1417-
1418- #> 1.. // FullForm
1419- = Repeated[1]
1420- #> 8^^1.. // FullForm (* Mathematica gets this wrong *)
1421- = Repeated[1]
1422-
1423- #> StringReplace["010110110001010", "01".. -> "a"]
1424- = a1a100a0
1425- #> StringMatchQ[#, "a" ~~ ("b"..) ~~ "a"] &/@ {"aa", "aba", "abba"}
1426- = {False, True, True}
14271373 """
14281374
14291375 arg_counts = [1 , 2 ]
@@ -1502,14 +1448,6 @@ class RepeatedNull(Repeated):
15021448 = RepeatedNull[Pattern[a, BlankNullSequence[Integer]]]
15031449 >> f[x] /. f[x, 0...] -> t
15041450 = t
1505-
1506- #> 1... // FullForm
1507- = RepeatedNull[1]
1508- #> 8^^1... // FullForm (* Mathematica gets this wrong *)
1509- = RepeatedNull[1]
1510-
1511- #> StringMatchQ[#, "a" ~~ ("b"...) ~~ "a"] &/@ {"aa", "aba", "abba"}
1512- = {True, True, True}
15131451 """
15141452
15151453 operator = "..."
@@ -1666,26 +1604,6 @@ class OptionsPattern(PatternObject):
16661604 Options might be given in nested lists:
16671605 >> f[x, {{{n->4}}}]
16681606 = x ^ 4
1669-
1670- #> {opt -> b} /. OptionsPattern[{}] -> t
1671- = t
1672-
1673- #> Clear[f]
1674- #> Options[f] = {Power -> 2};
1675- #> f[x_, OptionsPattern[f]] := x ^ OptionValue[Power]
1676- #> f[10]
1677- = 100
1678- #> f[10, Power -> 3]
1679- = 1000
1680- #> Clear[f]
1681-
1682- #> Options[f] = {Power -> 2};
1683- #> f[x_, OptionsPattern[]] := x ^ OptionValue[Power]
1684- #> f[10]
1685- = 100
1686- #> f[10, Power -> 3]
1687- = 1000
1688- #> Clear[f]
16891607 """
16901608
16911609 arg_counts = [0 , 1 ]
0 commit comments