9 votes

Removed all undefined from a list of rules

Select only NumericQ solution Select[rules, NumericQ[Last[#]]&] Or delete the instances ...
user avatar
  • 28.5k
8 votes
Accepted

Removed all undefined from a list of rules

t = rules /. HoldPattern[x_ -> Undefined] -> Nothing EDIT Another variation: Values[rules] can be used: (Also try ...
user avatar
  • 14.1k
7 votes
Accepted

Finding words that start and end with same letter

Since you said that the start/end character was specified, you could do this: StringBookendedQ[char_] := StringMatchQ[char ~~ ___ ~~ char] and then this: ...
user avatar
  • 3,452
6 votes

StringReplace question from "An Elementary Introduction to the Wolfram Language"

Decompose the problem. For example, "Make any 2-letter word uppercase" is a problem that you can probably solve (hint, there is a built in function for that). Now move on to "Make any 2-...
user avatar
  • 3,452
6 votes

Finding words that start and end with same letter

Consider: AbsoluteTiming[ res = Pick[WordList[], StringMatchQ[WordList[], x_ ~~ ___ ~~ x_]]; ] (* {0.040667, Null} *) ...
user avatar
6 votes

Removed all undefined from a list of rules

We can use DeleteCases as follows: ...
user avatar
  • 348k
5 votes
Accepted

Replacement, PatternTest, Module related Question

The reason your attempt fails is that at the time the Function is applied to its arguments, m has not yet been replaced by ...
user avatar
  • 23.2k
3 votes
Accepted

Pattern match with "+" sign

ClearAll[Pr2] Give Pr2 the attribute HoldFirst ...
user avatar
  • 119k
3 votes

Counting negative values in list

Another one: Total@Boole@Negative@data
user avatar
  • 4,878
3 votes
Accepted

How to make a pattern that matches only when one of the argument's Head is a Plus?

I think that there is some ambiguity in your description, so this probably needs some tweaking, but here goes... ...
user avatar
  • 3,452
2 votes
Accepted

StringReplace question from "An Elementary Introduction to the Wolfram Language"

...
user avatar
  • 58.2k
2 votes

Finding words that start and end with same letter

Another way: ...
user avatar
2 votes

Counting negative values in list

As a short variant Count[data, x_ /; x < 0]
user avatar
1 vote

Finding words that start and end with same letter

A solution using Reap/Sow: ...
user avatar
  • 14.1k
1 vote
Accepted

Confusing abnormalities observed when counting a specific operator in an expression

Your Plus[__] is getting evaluated to just __. You could wrap it in HoldPattern, or you could just use ...
user avatar
  • 3,452

Only top scored, non community-wiki answers of a minimum length are eligible