Tag Info

New answers tagged

1

Usually one does not need what you ask for. E.g. a pattern for an even integer greater than 10: x_Integer?EvenQ /; x > 10 (_Integer is not strictly necessary here as only integers will pass EvenQ however it should make the pattern a bit more efficient.) But since it is an interesting quesiton here is one idea: matchAll[expr_, form_] := ...


5

To directly get the opposite of Alternatives, you could negate each pattern with Except and then negate the Alternatives: also[patts__] := Except[Alternatives @@ Except /@ {patts}] Cases[Range[1, 15, 1/2], _Integer ~also~ _?(# > 10 &)] (* {11, 12, 13, 14, 15} *) Generally some other approach will be simpler, though, as discussed in the comments.



Top 50 recent answers are included