Message Boards Message Boards

0
|
2071 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

View user defined function definitions?

Posted 4 years ago

Is there a method for viewing the definition and arguments for a user defined function in Wolfram Language?

POSTED BY: Don Naumann
4 Replies
Posted 4 years ago

Definition is excellent - thanks!

POSTED BY: Don Naumann
Posted 4 years ago

Also

Definition@f

f[x_?(x>=0&)]:=Sqrt[x]     
f[x_]:=x

This will open a new notebook with the definitions.

Needs["GeneralUtilities`"]
PrintDefinitions@f

Global`f[PatternTest[Pattern[x, Blank[]], Function[GreaterEqual[x, 0]]]] := Sqrt @ x;
Global`f[Pattern[x, Blank[]]] := x;
POSTED BY: Rohit Namjoshi
Posted 4 years ago

Excellent - thank you for your help.

POSTED BY: Don Naumann
Posted 4 years ago

Hi Don,

f[x_] := x;
f[x_?(x >= 0 &)] := Sqrt[x]

Information@f

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract