4
votes
1answer
69 views

Dot when used in a pattern becomes Times… Why?

In[1] := Hold[a.b] // FullForm Out[1] := Hold[Dot[a,b]] So far so good. ...
4
votes
0answers
116 views

Syntax error for optional pattern, but only in debugger

This expression (explained here by Leonid) evaluates fine unless Evaluation->Debugger is enabled: h[x : (_Integer) : 1] := x Syntax::sntxf: "x:" cannot be ...
1
vote
0answers
36 views

Matching Root[…] objects with patterns, unexpected hidden argument

I needed to write patterns that could distinguish between arbitrary-function and polynomial forms of Root objects, for example, ...
2
votes
2answers
315 views

Write a function that returns the logarithmic derivative

How can we write a function that if we input an expression f, it returns the log derivative $\frac{1}{f} \frac{df}{dx}$. We have to use a conditional or pattern test so that the function accepts any ...
11
votes
4answers
442 views

Calling Table with custom iterator

I often find myself in situations where I, for example, need to build a table for some expression, but want to set the number of points rather then the step size, so the code ends up looking like this ...
0
votes
1answer
416 views

What does the slash-colon symbol do?

I came across a bit of code that uses the syntax /: and I don't know what it does. I can't find its documentation, or maybe I'm just not looking properly. The code ...
4
votes
1answer
299 views

Path queries for tree-structured data

Can anyone suggest documentation or tutorials for developing path queries and indices for (XML-like) tree-structured data? Suppose data is organized hierarchically in key->value pairs, eg: ...
4
votes
1answer
102 views

How do you set an Optional parameter with a global variable on a Function defined in a Package

In a Package I am writing, I'm trying to define a function with an Optional parameter in it that is set to a global variable. ...
19
votes
1answer
414 views

Why doesn't PatternTest work with Composition?

While playing around with the solutions to this question, I've found some very strange behaviour: ...