« first day (2838 days earlier)      last day (1947 days later) » 

01:31
hello
can anyone tell me where can I read about bind and rebind in Mathematica?
 
6 hours later…
07:10
I'm not sure if I missed something trivial. Why is the cell highlighted in red even though there are no errors, and everything is working as expected? This has happened a few times.
 
3 hours later…
09:55
@anhnha what do you mean by bind and rebind? I don't remember seeing those words in a Mathematica context.
@WeavingBird1917 There is an error, you can click the small plus button to see it. It says "Unknown string escape \w". What you have to do is add another backslash: RegularExpression["^\\w+o$"]
It might be easier to understand this with a more familiar string escape, \n for new line. If you write \n in a regular expression, do you mean to split the string in two lines e.g. the pattern is given as input in two lines, or do you mean to match the new line character?
In this case I guess it is working because Mathematica tries to parse \w as an escaped string but it fails because it doesn't know what \w stands for, so it leaves it in the string unchanged.
Thanks! I wouldn't have caught that. For some reason clicking on the + button does not seem to work, it stopped working a while ago.
 
2 hours later…
12:13
@C.E. it's in the last answer here.
https://mathematica.stackexchange.com/questions/52064/why-are-functions-called-first-class-objects-in-mathematica/52095?noredirect=1#comment535200_52095
 
3 hours later…
14:55
@anhnha ok, now it's clearer. In that context, "binding" and "rebinding" is basically about how Set (=) changes the value of symbols that it operates on. For this, the documentation should be enough, but as others pointed out, to get a deeper understanding, you also need to understand non-standard evaluation, i.e. how attributes such as HoldFirst affect evaluation.
You can read about non-standard evaluation here.
@CarlLange What material did you use for printing? It looks so stone-like.
15:54
@C.E. honestly, the cheapest PLA I could find. The paint helps a lot!
16:17
@CarlLange ok, cool.
 
4 hours later…
20:13
Thanks
How can this command work as Cases require its argument is a list but it isn't here?
Cases[Unevaluated[ 1 + 3.5 + Pi + x + (3 - I)^2], _Integer | _Rational | _Real]
Please tag me if you know the answer
20:25
@anhnha See the first point in "Details & Options" in the documentation of Cases
@LukasLang thanks, why doesn't it expand (3 - I)^2?
@anhnha why should it? You're explicitly telling it not to (using Unevaluated) after all. Or did you mean something else?
20:57
@LukasLang okay, I'm reading a tutorial code
 
2 hours later…
22:41
{x, y, z} = {77, 88, 99};
Map[Context, Unevaluated[{x, y, z}] ]
{Global`,Global`,Global`}

Without the Unevaluated, the x, y, and z would become integers before Context could act on them.
========================
Question: Aren't that variables x, y, z already integers after the first Set command?
Hm, maybe I got it. If I don't put Unevaluated {x, y, z} will be replaced by {77, 88, 99} and the Map and Context function only see {77, 88, 99}
23:03
@anhnha Exactly, Mathematica has a lookup table of values for symbols. After Set, this lookup table knows that x has the value 77, y has the value 88 and so on. Unevaluated tells the interpreter to not look up the values in the lookup table, so when Context is applied, it is really applied to the symbol and not the value of the symbol.
@C.E. thanks.
I'm just curious why Mathematica chose shorthand notions like that?
For example @@ is for Apply, /@ for Map.
Is there any basis for the notations?
23:21
@anhnha@anhnha Wikipedia has a list of languages that Wolfram Language was influenced by. I don't know many of them, but maybe some of it came from those. It seems like SMP, the symbolic math programming language that Stephen Wolfram wrote almost ten years before releasing Mathematica, looks similar syntax-wise.
In conclusion: I don't know, but Stephen could have been influenced by other languages of the day (languages that he and his collaborators may have been exposed to in the 70s and 80s).
If someone has an authoritative answer then I too would be very interested.
@C.E. yeah, that seems interesting to read. By the way I have a question while reading tutorial.
==================
If you've got a set of things inside Hold, and you want to map a non-holding function such as Head across them, then you can use the idiom:

f /@ Unevaluated /@ Hold[e1, ..., en]

which will form this frozen expression, with the calls to f colored in blue:

Hold[ f[Unevaluated[e1]], ..., f[Unevaluated[en]] ]
=================
I tried to implement the first command in Mathematica but there's an error saying that Syntax::sntxf: "Unevaluated/@" cannot be followed by "Hold[e1,...,
@anhnha You can't have "..." in there. That's just a placeholder the tutorial uses for actual content. Try f /@ Unevaluated /@ Hold[x, y, z]
ah, that's right. I forgot to edit it.
Btw, why not put Hold at the begining?
like Hold@
Hold@f /@ Unevaluated /@ {e1, e2}
@anhnha Hold[f][Unevaluated[e1]] is not the same as what you had before. Sure, you can do it, but it's not the same thing.
23:36
Hold[ f[Unevaluated[e1]], ..., f[Unevaluated[en]] ] is Hold for entire expression while f /@ Unevaluated /@ Hold[e1, ..., en] is only Hold for ei so how are they equivalent?
@C.E.
@anhnha The first is what the second becomes when we run that piece of code through the interpreter. I'm not sure what kind of equivalency you are looking for.
They're two ways to write an expression, right?
so they're equivalent
@C.E.
@anhnha We have to define what we mean by "equivalent". For the purpose of pattern matching, for example, those two expression are not equivalent.
@C.E. okay, can you explain the term 'wrapper' and 'stripped' here?
English is not my native language and I don't quite understand it here.
@anhnha Wrapping something in Unevaluated means to apply Unevaluated onto the thing: Unevaluated[f[x]]. In this case, Unevaluated wraps f[x]. Stripping Unevaluated means to remove Unevaluated. f[x] is the same as Unevaluated stripped off of Unevaluated[f[x]].
I have to go and sleep now, so I won't be able to answer more question for several hours.
23:51
Great, thanks for the help!
np!

« first day (2838 days earlier)      last day (1947 days later) »