« first day (1903 days earlier)      last day (2571 days later) » 

12:01 AM
A common message when using On["Packing"] is "Unpacking array in call to HoldForm", what is the role of HoldForm in these scenarios?
 
 
2 hours later…
2:08 AM
@C.E. Do you have a small example for this message?
 
@halirutan I think I just figured it out. I was being stupid. It occurs when an expression returns unevaluated, as in m = ToPackedArray@{{1, 2, 3}, {4, 5, 6}}; m[[1, 2, 3]].
So that explains why HoldForm is there, it is wrapped around the output.
 
@C.E. Yep.
 
 
7 hours later…
9:23 AM
@halirutan Have you any idea about this? mathematica.stackexchange.com/q/141776/12
 
@Szabolcs Is is only this function that steals the focus? I would expect something like this from dialogs or other windows.
 
10:23 AM
@halirutan I do not know if there are others too. This is the one particular function that steals focus in the clipboard code that WReach gave me.
Does it happen on Linux?
Kuba confired that it does not happen on Windows.
 
@Szabolcs I'm currently at my office Mac and I see the same behaviour as you do. Have you tried what happens, if you put this function into a real Java jar and call it?
But I have found information:
2
Q: Maintaining Focus While Not On Top Java

IroncacheI'm looking to do something which may be impossible; in Java (1.6 running on Windows 7, since this is platform-dependent), I want to have a window appear over another window, but not steal focus from the triggering component. In the example attached below, I'd like to be able to be able to click...

and this here
@Szabolcs The problem is that the simple call to getdefaulttoolkit steals the focus. I don't see how you can set/debug focus behaviour there.
 
 
1 hour later…
11:54 AM
@rcollyer Just wanted to ping you in case the OP doesn't report this. mathematica.stackexchange.com/q/141780/12 I am not 100% sure it is a bug, but it does look weird ....
 
12:36 PM
Did you know that PlotRange could be used as a function? Is this deprecated usage?
11
A: Get Axes Range of Plot?

kglrAlso PlotRange[plot] PlotRange /. AbsoluteOptions[plot] Last @@ AbsoluteOptions[plot, PlotRange] PlotRange /. plot[[2]] all give (* {{0.,10.},{-0.999999,1.}} *) Note: Regarding usage of PlotRange as a function, it is undocumented, and the earliest reference I could find on this site is this...

 
@Szabolcs Yes, I knew it. You see it when you Trace a plot and once, JM mentioned it as well.
 
How to understand this syntax problem? {___}:{}?
 
12:52 PM
@Kuba Give it a name, name : {___} : {}.
 
@Szabolcs That was not the question but thanks for attention :)
 
I meant that I guess the re-use of : for two unrelated things creates some constraints on the parser.
 
Yep, but is my example ambiguous?
 
@Kuba I guess not. But is there any use for an Optional without also giving the pattern a name?
I tried to create one but couldn't. f[a : {_, _ : 1}] := a; f[{2}] returns {2} and not {2,1}`.
 
@Szabolcs This is mathematica, there is no point in constrains unless they have a reason.
 
12:57 PM
My last comment was a question, not an argument.
 
@Szabolcs I know, I mean, even if I could not come up with valid example, it should work :)
 
Something vaguely related: mathematica.stackexchange.com/q/108636/12
(I.e. how should it handle stuff that may not make sense.)
 
@Szabolcs Thanks, I'm currently using Optional[{___},{}]
 
@Kuba Yes, but what for? I am really curious.
When does Optional have an effect if the pattern has no name?
 
@Kuba The problem is the parser here if you use the infix form : because it is not clear that you don't mean a pattern. The way is as you said to use
f[Optional[{___}, {}]] := True;
 
1:06 PM
@Szabolcs I'm too stupid for those fancy OO frameworks and my application needs some freedom so I don't want to be so tied. I'm working with 'objects' defined as associations and their 'classes' contain properties like "property1" -> _String : "". I can use that classes to match arguments as well as skip constructors etc just by replacing Optional with #2&. Etc etc, but again, this is really lightweight and not so strict.
 
@halirutan Yes, but one may argue that the ambiguity is always there, and is resolved based on the type of the first part. Thus:
In[31]:= a:1//FullForm
Out[31]//FullForm= Pattern[a,1]
In[32]:= _:2//FullForm
Out[32]//FullForm= Optional[Blank[],2]
The only difference between these two forms is that the first one has a symbol and the second a Blank[]
 
@halirutan how could I name pattern {___}?
 
Another more explicit way is to turn your first part into a pattern:
g[_List : {}] := True
 
What also makes sense to me is that the parser wouldn't know about types (Symbol, Blank). Parsing must finish before that information is available.
Thus letting the parser handle some of these complex cases may introduce a lot of complexity for very little gain
 
@Szabolcs @halirutan is anything else than a valid variable name allowed in the first argument of pattern?
If not, is it too much to handle for the parser?
 
1:10 PM
@Kuba My experience with writing parsers is much more limited than @halirutan's, but yes: I can imagine that it is just too much trouble (relative to the gains).
 
@Kuba From the doc, no:
> The name s must be a symbol.
 
Yes, exactly. That is stated under Pattern. But my understanding was that it is exactly this what lead Kuba to believe that anything that is not a symbol name and is followed by a : will lead to : being interpreted as Optional (and not as Pattern).
What seems to be the case instead is that only a limited set of things are allowed before : for both the Pattern interpretation and the Optional interpretation. Anything else triggers an error.
 
@Szabolcs I thought it exactly the other way around.
 
Note that _ : 1 is valid, and is interpreted as Optional.
 
Only when the parser sees a pattern, and yes the Blank constructs are viewed as pattern, the : is viewed to be Optional.
This is why my _List example works.
 
1:18 PM
It seems that a lonely Optional-: will only allow Blank (or __ or ___ or all the variations on _ such as s_, _h and s_h)
Otherwise name : patt : value is needed.
 
@Szabolcs Exactly how I understand this.
 
Does Mathics still work online?
I'm curious how it handles this.
Or the Workbench parser.
There are surely some inconsistencies between them.
 
@Szabolcs Yes, this is born to introduce trouble. Idea will definitely make it wrong.
 
Mathics works just like Mathematica.
The problem is that even a simple symbol name is technically a pattern (anything is a pattern), so the implementor may have thought it safer to restrict the single-: as much as possible, to prevent people from shooting themselves in the foot.
The double-: is unambiguous.
 
Due to the large number of operators, Mathematica consists of many such troubling points.
 
1:28 PM
Yeah, it's easy enough to shoot yourself in the foot as it is, so who cares about one more way to do it? :D
Mathematica got a lot of criticism for its syntax in the pre-notebook days. You can write things like x/.1 -> 2, which are ambiguous, and in fact are interpreted as x / .1 -> 2 and not as x /. 1 -> 2. The front end adds clarifying spacing around operators, so this is not a big problem in practice anymore.
 
@Szabolcs Still, it is one of the reasons why I like Java and C. Pure, simple, and most of all very consistent.
Especially C.
 
C++, not so much ...
In C++, when creating new standards they actually try to re-use existing keywords with different meanings in different contexts. That's because adding new keywords risks breaking old stuff.
 
@Szabolcs Nope, that's why I wrote C :) C++ templates are just too much for me if you don't use it every day and this is only one example.
 
> if you don't use it every day
 
@Szabolcs Yes, it is undocumented usage, so your mileage will vary.
 
1:37 PM
I would like to say that I am good at C++, but that is only the case when I keep using it continuously for 2 months at least. When I stop using it, I lose practice and I forget. Can't keep all that stuff in one's head permanently ... it's not just the syntax, but also all the idioms and the unexpected interactions, etc.
 
@Szabolcs definitely looks weird. The simplest workaround is setting ImagePadding -> {{Automatic, Automatic}, {50, Automatic}}.
 
@rcollyer If I remove the Legended, and just use Show, then the top padding is also too large.
 
@Szabolcs Yes, this the point. I guess I could be good in Java or C, but not with the limited time I spend with those languages.
 
@rcollyer Do you remember that bug when using symbols like Small, etc. with Arrowheads tends to cause excessive padding for no apparent reason? Is that on the radar?
 
@Szabolcs from the looks of things, it isn't from anything in the plots ...
@Szabolcs vaguely. It isn't on my radar. I'll look for it.
 
1:41 PM
I also can't reproduce it off-hand.
 
@halirutan templates are one of my favorite parts of c++, even if I'm no good at them.
@Szabolcs I think it was fixed, but I don't recall.
 
The reason for using Small, etc. is that they are interpreted as absolute sizes. Number are interpreted as scaled sizes. It would be nice to have numerical absolute sizes.
 
I never noticed.
 
@rcollyer Yes, I like them too, but then I made a mistake and read the book from Andrei Alexandrescu and I instantly realized, I know nothing :)
 
You can do cool things like this with C++ templates: szhorvat.net/pelican/fast-computation-of-powers.html We can write code that generates efficient code at compile time. What really bothers me that all of this is a hack. Templates were not originally meant for this. Now they are widely used like this, but there isn't a proper replacement ...
 
1:44 PM
@halirutan ha! I was about to recommend reading it. Yes, I know nothing, either.
 
21
Q: How can I specify the arrowhead size in printers points?

Jim BelkIs there any way to specify the size of an arrowhead in printer's points? I'm looking for something that would have similar functionality to AbsolutePointSize, AbsoluteThickness, or AbsoluteDashing, except for Arrowheads. The best I have come up with is to use something like Arrowheads[1.5/???]...

 
@Szabolcs there is a story that shortly after designing templates, the c++ committee watched a demo where the presenters printed out the first 100 primes via the compiler's error messages.
 
When that happens, it should be taken as a warning :D
 
It meant the DSL they created was much more powerful than they had envisioned.
they just needed to name it skynet. :D
My original foray into templates was in discussing temporary object elimination. But, a more recent version works better and is more general: Expression templates.
 
@rcollyer What I would like to see (but I am not good enough with C++ to do it well, and I don't have the time to learn C++ well enough for it), is a MathLink interface written in C++. It should have an easy notation for M expressions, e.g. link << Plus(1,2) (or rather something more feasible but similarly easy) should send Plus[1,2] to the link.
 
1:53 PM
@Szabolcs the J/Link interface is not bad. I don't know enough java to say much more than that, though. But, I think you're right.
 
I would also very much hope to see MathLink (not the kernel—just MathLink) open sourced. This would suddenly make it possible to link GPL'd libraries to Mathematica.
The MathLink libraries (binaries) can already be distributed under a more permissive license.
 
at a minimum, I'd like to see generic functions instead of WSPutReal32, WSPutReal64, etc. a WSPutReal.
 
@rcollyer That I have done in an auxiliary library included in LTemplate, but I need to clean it up ... I made the mistake of trying to support C++98, which made it messy to work with types.
So the whole thing will be replaced.
 
Some of the things even in c++11 are very, very nice. c++14/17 are even more interesting.
@Szabolcs I have to look through that, again.
 
@rcollyer At the moment it is in a bit of a mess, while trying to fully transition to C++11 and add RawArray support
So far, only one person told me that they are using it, so I lost motivation to try to keep it clean ... But I have not given up on it.
 
1:58 PM
@Szabolcs it's on github, right? I'll take a look and see if I have any suggestions.
 
@rcollyer Yes.
 
time to run.
 
@rcollyer mathematica.stackexchange.com/q/96127/12 At the moment it serves as the foundation of IGraph/M, and I use it frequently for my work. I like to integrate most things I do in C++ with Mathematica, so I can immediately transfer/plot the data, and have access to algorithms, like FindRoot. If you like, I'll mail you a presentation I did at a Wolfram Seminar here in France. It has more examples and a simple Ising model simulation.
 
 
2 hours later…
3:32 PM
0
Q: Would like more detailed guidance on duplicate questions

theoristI understand that, to avoid cluttering the site, one should avoid asking questions that have already been answered (though there is this: https://stackoverflow.blog/2010/11/16/dr-strangedupe-or-how-i-learned-to-stop-worrying-and-love-duplication/). But what if you have a good question that is ...

 
 
2 hours later…
5:49 PM
@J.M. Sorry, I don't understand your "you need to unprotect first".And have you tried GeneralUtilities`HasDefinitionsQ[Plot]?
 
6:08 PM
@yode Plot[] is not (fully) implemented in top level code.
Anyway: Unprotect[] + ClearAttributes[]. You'll want to search on how to use those.
 
@J.M. top level code?
 
 
3 hours later…
8:58 PM
@yode Wolfram Language itself. Part of implementation is done in C etc.
 
Thanks~I don't know the term before this. :)
 

« first day (1903 days earlier)      last day (2571 days later) »