« first day (1749 days earlier)      last day (3033 days later) » 

01:27
@MichaelHale sorry to ping you but you have incredibly helpufl
how do you declare optional arguments in an anonymous function
 Function[{Options@x}, x]
anyone else if you are around would appreciate help
 
9 hours later…
10:24
Is there a way to increase the distance between the first x-axis tick and the first y-axis tick? They tend to get awkwardly close in my plots.
I understand that I would ideally give you a sample code, but that would take quite a while as its a rather involved example (see this plot i.imgur.com/UQhJNp2.png). So I was just wondering if anyone could come up with a quick command from the top of their head, else I'll just look for a while longer myself and in the end give up and put in the effort to make it an actual question.
So please don't spend longer than just a few seconds on it, my laziness/tendency to try and find a quick fix shouldn't be rewarded all that often.
10:43
In a way Im looking for the inverse of PlotRangePadding I suppose; I do not want the things inside my frame to move further in, I want the ticks outside to move further out
 
3 hours later…
13:43
@William That sounds pretty vague. With optional arguments people usually mean "arguments that can be omitted". That has nothing to do with Options (it does have to do with Optional). There is no way to have this kind of optional arguments in an anonymous function (without errors). You can have more inputs than required, for example #&[2,3] gives 2, but not fewer, for example {#,#2}&[1] gives a message that I think almost all MMA users would interpreted as an error.
I suppose we can define optional arguments if we are willing to consider this to be an informative message rather than a real error, because then we can do something like this (first piece of code is virtually unreadable, but you can use it)
@JacobAkkerboom could I define a wrapper function that convert them to a List/Array and then calls the anonymous function
ugly but would work I think
I just have one optional argument
sorry, I had a phonecall, just a sec
Ok, here is the first bit of code, which can be used like Function. The code is quite unreadable, but the examples will be simple
optionalFu =
 Function[Null,
  ReplacePart[
   Function @@ Hold[
     Null,
     Quiet[## &, {Function::slotn}],
     HoldAll
     ]
   ,
   {2, 1, 0} -> Function @@ Hold[##]
   ], HoldAll]
fu1 = optionalFu[{#}];
fu2 = optionalFu[Null, Hold@#, HoldAll];
fu1[1, 2]
fu2[Print[a], Print[b]]
(*{1}*)
(*Hold[Print[a]]*)
14:00
@JacobAkkerboom and what if I wanted to be omit the arguments completely
@William sorry, the code above is silly, I blame the phonecall :P.
I believe I understand
This was really the example I had in mind:
optionalFu[{#, #2}][1]
(*{1, #2}*)
it works just like Function, but supressed the error
But of course you are still stuck with #2 and you have to decide what to do with that
you have been very helpful now how do I define a default value
is this the best idea
optionalFu[{#, If[#2 == #2, True, False]}][1]
neverind that will always be true
@William ahh, of course, that is how we can handle values that are not present, haha. Let me see about that. (Also I am glad I am helpful, I felt like I was getting carried away :p )
14:24
@JacobAkkerboom thank you for the help
this is what I am doing now
optionalFu[{#, If[ToString@# == "#", True, False]}][1]1
better then what I was doing
you are a genius this is so much nicer then what I was doing thank you again
14:44
@William Ah thank you very much for the compliment. I hope it will continue to be useful to you, but I think I have to urge you to be careful, it may be hard to debug or something and remember that it is very non standard. Good luck!
15:03
Ok, the following is a beast of an unreadable function that may be useful. Note that I did not test it very well, if you are going to use it seriously, you may want to do this yourself.
optFuWithDefaults =
  Function[Null,
   Module[
    {fuToken, argsWrapped, nSlots},
    nSlots = #3;
    argsWrapped = Slot /@ Range[nSlots] /. #2;
    ReplaceAll[
     (*this function protects the final slots*)
     Function[Null,
      (Function @@ {
          Null,
          fuToken[##],
          HoldAll
          }) @@ argsWrapped, HoldAll]
     ,
     Join[
      {fuToken -> optionalFu @@ Hold @@ Unevaluated@#},
      OwnValues@argsWrapped
      ]
     ]
    ], HoldAll];
fu4 = optFuWithDefaults[{{#, #2}}, {#2 ->
     3},(*this is the number of slots used in the first argument*) 2];
fu4[1]
fu4[1, 2]
(*{1,3}*)
(*{1,2}*)
I have posted your other simpler version as answer to my question
I only have 1 optional argument so I think the simplest version is probably better but you are welcome to post it as an answer to my other question
@William ah, I was unaware of the question. Nice that you have an answer.
15:25
Can anyone please help me get the correct column and row order as per the answer of kguler in here?
http://mathematica.blogoverflow.com/2012/10/turning-up-the-heat-maps/
 
1 hour later…
16:36
@William I have decided to vote close your question. Please don't see this as negative, it is more of an administrative decision. I just feel your question is not really different from the other question. I also think Mr.Wizard's answer may serve you well.
 
1 hour later…
17:40
This is a weird request but would anyone be interested in helping with this mathematica.stackexchange.com/questions/114666/…
I have run into some issues that I haven't been able to figure out
I'm trying to develope a mathematica shell but can't get the piping to work correctly
 
1 hour later…
18:47
ok I figured it out thank you for the upvotes people
@William Thats nice to hear. I see you used "optionalFu" :). I hope I get around to looking at your answer in more detail, it sounds interesting.
19:44
There is an option that you can use on a control specification in a Manipulate that lets you define the functions in the second parameter of Dynamic. Can anyone recall what it is. It is not in the help.
Found it. TrackingFunction
20:50
http://community.wolfram.com/groups/-/m/t/952098
Exploring 10,934 Wolfram Demonstrations

« first day (1749 days earlier)      last day (3033 days later) »