« first day (2322 days earlier)      last day (2460 days later) » 

06:27
one of the most annoying things for me in Mathematica, is that printing or returning expressions generated using local module variable contains those extra $nnnn. There are some hacks to go around these, but these do not work when one wants to use other functions. For example compare:
while in Maple, it works as is
Can anyone help? Solve function not working:
((hc[t] /. Solve[0 == (hc'[t] /. sc[[1]]), t][[1]]) /. sc[[1]]) /. {k -> 500} This equation outputs 70713.3
But when I try and solve it for k (which should be 500, as above equation shows), it gives multiple errors:

Solve[((hc[t] /. Solve[0 == (hc'[t] /. sc[[1]]), t][[1]]) /. sc[[1]]) == 70713.3, k]
07:18
LayeredGeoGraphics -- An awesome way to build multi-layered custom maps!
http://community.wolfram.com/groups/-/m/t/1345014
07:36
@Nasser Would using Block instead of Module be acceptable for you? This issue is the essential difference between the two, isn't it?
07:58
@Nasser
MakeBoxes[x_Symbol/;Attributes[x]==={Temporary},StandardForm]:=StringReplace[ToString[Unevaluated@x,InputForm],{var_~~"$"~~DigitCharacter..:>var}];foo[]:=Module[{x,y,s},
Print[x^2+3 y]
]
foo[]
@HenrikSchumacher difference between Block and module is tricky. according to post here mathematica.stackexchange.com/questions/559/… "Block therefore affects the evaluation stack, not just the literal occurrences of a symbol inside the code of its body. Its effects are much less local than those of lexical scoping constructs" so I think lexical scoping (module) is safer to use, specially for large code.
From reference.wolfram.com/language/tutorial/… block has dynamic scope and module is lexical.
@RolfMertig thanks. I know there are ways around these, https://mathematica.stackexchange.com/questions/137036/print-expressions-using-local-variables-in-module-without-dollar-sign-is-that-p but the issue is can get complicated. For example:
<< MaTeX`
foo[] := Module[{x, y, s},
s = MaTeX[ x^2 + 3 y];
Print[s]
];
foo[]
I do not know how to use MakeBoxes in the above.
08:51
@Nasser You only need to patch MaTeX a bit:
Unprotect[MaTeX`Developer`Texify];
MaTeX`Developer`Texify[expr_] := (( ToString@TeXForm[expr])) //.
   s_String :>
    StringReplace[
     s, {Longest[var__] ~~ "$" ~~ DigitCharacter .. :> var,
      "$\$" -> ""}];
Protect[MaTeX`Developer`Texify];
@Nasser I think the main concern in using Block would be dynamics so if you run it like PreemptProtect @ Block[... it should be fine. I mean, Table and friends they all use Block under the hood. So at the end I would not even bother with PreemptProtect
09:14
@Kuba Block is also problematic when using symbols. Consider this for example:
I think this is the main reason why it is said that Block makes it harder to reason about code.
@C.E. ok, right, then I guess it depends of the use case.
@C.E. @b3m2a1 I have a question, index.html files are now supported by cloud but I wonder how to use relative sources robustly. I can't use `/assets/logo.png` because `/` refers to cloud base which will almost never be your index.html container.

One could use `./assets/logo.png` and it will work when you start your app from `{cloudbase}/something/myApp/` (index.html dropped) but the way index.html is supported makes `{cloudbase}/something/myApp` (without final /) a valid URL too. It will be found but it will be corrupted because lack of `/` means that `./assets` points to `/something/asset
10:01
I don't know.
 
2 hours later…
11:36
@Nasser I think Block is generally fine to use as the main container for the code of a function for as long as that function cannot receive any symbols as input (either directly or indirectly).
For example, f[n_] := Block[{x}, D[x^n, x] /. x -> 1] is not safe because f[a] is a but f[x] is unexpectedly 1. However, if we had f[n_?NumericQ] then it would have been fine.
@C.E. Here the issue is not Block, but the definition of g[]. Solve[2x==1,x] simply doesn't work if x has a value. That could be a global value too, not only a value temporarily set by Block.
With Block, the global symbol x stays the same global symbol x. Only its assigned value changes temporarily. With Module we get an entirely different symbol.
Thus, for as long as we only use a symbol as a "variable", to hold a value, either Block or Module is fine. Once that symbol is allowed to be used as a mere symbol, e.g. in a symbolic calculation, the differences become important.
 
2 hours later…
14:04
@Kuba Would you happen to know how it is decided how many moderators an SE site has?
I'm asking, because while math.SE has 10, we have currently only on 2 active. How does a site increase their number of moderators? Last time, when you were elected, we lost Verbeia. So it was a zero-sum-game.
@halirutan I only participated in this and last elections so I don't have much experience or an overview of other subsites, it may differ. From my experience: elections and its specification is not automatic and we certainly are not limited to 5. But I will search around later, have to go now.
@Kuba OK. It was out of curiosity if there is the possibility that we can have 3 additional moderators or if this is out of question.
14:50
@Szabolcs I intentionally made a problematic definition of g, the problem that you are pointing out is what I wanted to convey. Sure, the problem is similar to that of using global variables. But I would also say that we shouldn't use global variables. There are cases where Block and global variables can be used efficiently, they just shouldn't be the first option.
15:13
@C.E. But when working interactively, we always use global variables, no? Of course those wouldn't conflict with symbols in a package context. Only global package variables would.
@Kuba Can multiple moderators be appointed after an election?
@C.E. I'm not trying to nitpick, just to show that "avoid Block" is not a universally applicable guideline.
15:32
@halirutan I don't think it is out of question but can't give you anything more now. @Szabolcs afaic yes
@Szabolcs I believe I have seen this happen. That's why I would like to know who is going to decide this.
But that was our first real election. So there might be a difference.
 
2 hours later…
17:21
@Szabolcs I think it is a good guideline. I don't like that Block is not local. If I were to use Block, I would have to have a specific reason for it. But I see where you're coming from, I think.
 
2 hours later…
18:53
@Nasser you could try Module[{x=RawBoxes["x"], y=RawBoxes["y"], s}, Print[x^2+3y]]
4
19:33
This got closed, but I do wonder about the best way to approach it in Mma ...
19:52
@halirutan It is most likely based on actual need + volume of flags... Currently, JM, Mr.W and myself are mostly inactive, leaving Kuba as the sole active moderator. For that reason, adding +1 makes sense.
However I don't think we need more than that — even though I'm "inactive", I do check in and read things at least 3-4 days/week and I have no flags to handle while I'm online. For some stats, in the past month there were 72 flags of which Kuba handled 32 and the rest were handled automatically by the community. The average resolution time was ~1 hour. This is a fantastic stat for a community and 32/month is not too high for a moderator either so 1 more would be just right.
20:16
Can Wolfram Alpha get a limit wrong?
@VincenzoOliva It is unlikely. It would be considered a bug.
20:30
@C.E. Would this bug extend to Mathematica, or finding the same result would actually mean WA was right?
@VincenzoOliva WA is typically a couple of versions behind Mathematica. That means that the bug may have been fixed, if it is a bug. On the other hand, one cannot be sure that they haven't introduced a new bug, either.
Fair enough, thanks.

« first day (2322 days earlier)      last day (2460 days later) »