Tagged Questions
2
votes
1answer
59 views
Flat function with repeated sequence
There are functions like Join[ ] that accept a variable number of arguments. Join is a flat function, as the order of arguments ...
1
vote
2answers
62 views
Named patterns as function argument descriptors
I have a function timeToMinutes that takes a 24-hour time as a string argument (in digital clock format, e.g., "15:47") and converts it to the number of minutes ...
3
votes
1answer
111 views
Downvalues vs. Scoping for Functions
Regarding my recent question on using a default value for a function argument when a pattern was not met yielded some interesting answers, but the general consensus was "Yes this can be done, but ...
6
votes
4answers
170 views
Function argument to default under certain condition
Inspired by this and this question (and how I handle this in practice), what is the best way to default a function value when a certain condition is met?
For example, if a function is defined as:
...
7
votes
2answers
228 views
Determine whether some expression contains a given symbol
Given a symbol t and an expression expr, how can I determine whether or not the symbol t ...
9
votes
5answers
674 views
Counting negative values in list
I would like to count the negative values of a list.
My approach was Count[data, -_] which doesn't work.
How can I tell Mathematica to count all numbers with ...
11
votes
4answers
287 views
Assessing argument type in set delayed function definitions
I'm wondering how to properly assess the type of arguments passed to functions defined with :=. I want my functions to be the most efficient, unambiguous and clear ...