# Bug in Operator Form of StringCases

fixed in 10.1 (windows)

According to the documentation there's an operator form for StringCases

?StringCases


Here is the normal form

 StringCases["abcadcacb", "a" ~~ x_ ~~ "c"]

{"abc", "adc"}


Now, the operator form:

 StringCases["a" ~~ x_ ~~ "c"]["abcadcacb"]


Can anyone reproduce this in Version 10.0.1? I'm on Windows 8.1.

• ditto on Windows 7 and the RPi – bobthechemist Sep 29 '14 at 0:41
• @bobthechemist. Thanks for confirming. – RunnyKine Sep 29 '14 at 0:41
• Same on OS X with V10.0.1. It seems the operator form really isn't available. – m_goldberg Sep 29 '14 at 1:00
• The documentation should have been set to a later version (in this case, by me). Sorry about that. – Daniel Lichtblau Sep 29 '14 at 15:25

Indeed, StringCases does not have an operator form in 10.0.1. The documentation and usage message appear to be in error.

StringCases does not appear on the list TypeSystem\$OperatorForms -- although that is by no means conclusive as discussed here. I would argue that it should have an operator form, in symmetry with Cases. In any event, there is a bug here either in the documentation or in the implementation of StringCases.

Note that operator forms for functions like StringCases and Cases pose some problems. For StringCases, there are two arguments that could credibly be curried: the pattern and the occurrence count. But if the caller specifies two arguments, it is ambiguous whether it means StringCases[patt, n] or StringCases["string", patt]. Such are the pitfalls of idiomatic currying when the arguments lists were not designed with currying in mind.

None of this reasoning conclusively argues against the single argument operator form which has reasonably unambiguous meaning. Further more, WRI have already elected to give Cases an operator form even though the currying situation there is even worse, with three arguments that could be curried (pattern/rule, levelspec, occurrence count).

fixed in 10.1 (windows):

code:

StringCases["abcadcacb", "a" ~~ x_ ~~ "c"]
`