Linked Questions

28
votes
3answers
632 views

Parentheses in pure functions: # & vs. ( # &)

I've been using Mathematica for years, and over time I have developed the habit of using: Select[data, (# == 1 &)] instead of ...
26
votes
2answers
1k views

when is f@g not the same as f[g]?

I have always thought that f@g will give the same result as f[g] in all cases, and it is just a matter of style which one to use ...
15
votes
3answers
372 views

How can I get the unchanged Box form of an arbitrary expression?

One may observe that MakeBoxes does not give the actual Box form of various expressions: MakeBoxes[{1*^4, 000123, a*b c}] ...
15
votes
1answer
667 views

How to Combine Pattern Constraints and Default Values for Function Arguments

EDIT: As several respondents have noted in the answers and comments below, the original example had a default value that would never be used because of the way patterns and default values are ...
5
votes
3answers
148 views

Metaquestion: how to find out why (e.g.) MatchQ[42, _?Function[x, True]] is False?

Suppose you run into a bewildering Mathematica result (which happens to me several times per Mathematica session, even after a 20-year acquaintance), such as, for example: ...
11
votes
1answer
278 views

Is there a guideline about when to end expressions with semicolons?

Whether for nested Ifs or within scoping constructs like Module and Block, I never know ...
10
votes
1answer
187 views

Infix form of PutAppend ( >>> ) does not work with variable

I'm new to Mathematica, so I suspect this question involves either a misunderstanding involving variables or the usage of >>>. On a webMathematica page ...
1
vote
2answers
149 views

Confused about scoping, not sure what to ask

I'm grading for a class using Mathematica right now, and one of the students ran into a weird issue. When he ran code like this: ...
3
votes
2answers
158 views

Why wouldn't ReplaceAll (/.) work with this list of number? [closed]

The answer to this might be simple, but why would ReplaceAll return such a weird result when replacing a number in a list of numbers: ...
0
votes
1answer
277 views

how to work with list as function parameter

I want to output an arrow based on input from user and I tried writing this small function to achieve this: ...
2
votes
4answers
210 views

Extracting RHS from Rule

In an example from another question, the rhs of a list of rules can be simply extracted: ...
2
votes
2answers
203 views

Deleting parts of groups that do not have equal dates

Find the intersection of dates within the pair and remove the other dates & corresponding prices. Also keep the list in same format as it currently is in. Let me explain: Each stock has closing ...
4
votes
1answer
148 views

How to see abstract syntax tree of Wolfram Language expression

I mean, suppose I have this expression: 2 + 2 I want to get something like this: Plus[2, 2] as an output. I've tried FullForm, but this just evaluates 2+2 and returns 4. Is this even possible?
6
votes
1answer
103 views

create function that behaves like continuedFraction [duplicate]

I'm just starting to learn Mathematica and I got stuck at this question. This a noob question but please help. I need to define a function named continuedFraction that takes user input of type list ...
12
votes
1answer
315 views

What is the real default CellEvaluationFunction?

The default CellEvaluationFunction is Identity but one can quickly see that this is handled specially as an equivalent function, ...

15 30 50 per page