Linked Questions

0answers
40 views

Find the arity of any function [duplicate]

First an example: f[x_,y_]:=x+y would have arity 2 because it takes 2 inputs while the function g[x]:=0 has arity 1, even though ...
19answers
137k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
4answers
4k views

Automatically generating a dependency graph of an arbitrary Mathematica function?

Has anyone written a function to pull the function dependencies of a function? That is, it would be nice to have a function that returns a list of function dependencies as a set of rules, terminating ...
1answer
1k views

What can I use as the second argument to Return in my own functions?

Having found out about the second argument to Return I played a bit with it, and the following tests all resulted in ...
4answers
1k views

How can I get the number of slots in Function?

Suppose that I define f = Function[#1 + #2]; And I want to define a new function, argsNum, so that it returns a number of ...
5answers
527 views

How to get the parameter number of inbuilt function

I want to make a custom function parameterNumber,which can return the parameter number of inbuilt function,as the Plot's ...
3answers
453 views

How to write a function-defining function which stores the function arguments in a stack?

I have a function-defining function SetAttributes[DefFn, HoldAll]; DefFn[f_[args___], body_] := f[args] := body; I am trying to modify this function to record ...
5answers
222 views

Using Through with SlotSequence

I have an expression consisting of a few pure functions added together like so: f+g+h I want to add the bodies of these functions together and make that a pure ...
1answer
220 views

Automatization of SyntaxInformation and argx?

Does anybody have a good way to automate the setting of SyntaxInformation for any custom function? I have a ton of functions for which I want to set SyntaxInformation, and doing it by hand seems a ...
1answer
157 views

How many arguments does a function require, and how to use that in Manipulate

The goal is to vary the order parameters in wavelet transforms in the Manipulate environment. The various transformations have arguments of different rank. For ...
1answer
232 views

Create jacobian Function from a vector Function

This is related to this question and maybe this question. I wanted a function that takes an n-parameter vector function and outputs a Jacobian matrix function, also n-parameter. I think this works: <...
1answer
237 views

Meta information about function parameters

I'm working on a project that allows for executing arbitrary, user-defined Mathematica scripts. It's an internal tool running on a trusted, local network. It's basically a web interface to Mathematica....
1answer
242 views

Examine function parameters programmatically

I write a lot of scripts in Mathematica and I'd like to eliminate the boilerplate that parses command-line arguments and assigns them to variables of the correct type before doing the real work. I was ...
0answers
112 views

Pattern for a function of say 2 variables [closed]

How can I specify a pattern for an expression f for which say f[x,y] returns a value, ie is defined as a function taking two ...