Questions tagged [pattern-matching]

Questions on expression testing and manipulation through pattern matching and constructing efficient patterns.

56 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
34 views

Define a function using pattern matching and repeated replacement to sum the elements of a list.(exercise in Paul Wellin's Book)

I am reading Paul Wellin "Essentials of Programming in Mathematica". I have a question about his answer to 4.1 Exercise 5. 4.1 Exercise 5: Define a function using pattern matching and repeated ...
0
votes
0answers
56 views

Trouble with UpSet(Delayed) and IgnoringInactive

I'm having problems setting an upvalue for a symbol that is supposed to ignore Inactive: IgnoringInactive[f[g[x]]] ^:= match; ...
0
votes
0answers
28 views

Problems on MatchQ[-3*i[1], -x_*i[1]]

In my Mathematica 11.3. MatchQ[-3*i[1], -x_*i[1]] returns False. But MatchQ[-3*i[1], x_*i[1]] returns True. I don't ...
0
votes
0answers
55 views

Why does StringReplace wrap StringExpression around result?

The task is to separate a leading separator from subsequent text into a list. Why does StringReplace wrap StringExpression ...
0
votes
0answers
34 views

Defining functions with pattern as argument

I want to define a function such that f[18/17 h[y][z]] = 18/17 z for any function h[y][z]. I first tried with ...
0
votes
0answers
53 views

\[Prime]s not recognised as derivatives in some versions

This is more of a warning to others than a question, so feel free to delete if not appropriate, though I do have a question as well. I think there is a bug in some versions of Mathematica, in ...