In chapter 5 of Eloquent Javascript () there is an example that I'm having a hard time wrapping my head around.     function greaterThan(n) {   return m =&gt; m &gt; n; } let greaterThan10 = greaterThan(10); console.log(greaterThan10(11)); // → true     I get the initial call of the function and assigning n to 10. It's when it's called a second time I don't understand how 11 would get passed to the variable m (wouldn't the parameter still be n? I almost want to think it would overwrite 10 with 11).   When I do alert(greaterThan10) it shows m =&gt; m &gt; n which I was also confused as to why it wouldn't show n as 10.
How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.
I need to do a polynomial interpolation of a set $N$ of experimental points; the functional form I have to use to interpolate is this:  $$ f(x) = a + bx^2 + cx^4,$$ as you can see the coefficient that I need to find are just 3: $a, b, c$; however the points I have are $\#N&gt;3$ and so it looks like the determination of the coefficients is impossible because is over-determined. Does anyone have an idea of what should be done in such case (supposing it is even possible)? What is the difference between "INNER JOIN" and "OUTER JOIN"? enclosing a lstlisting environment inside my own environment using matlab-prettifier I've just started using matlab-prettifier.    Since the line \begin{lstlisting}[style=Matlab-editor] is a lot to type, I created my own environment:  \newenvironment{myMP}      {\begin{samepage}\begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting}\end{samepage}}   I've used this syntax many times before, but in this case it doesn't work.  Is there any reason why I can't enclose the lstlisting inside my own one?  Here's sample code, illustrating the problem.  \documentclass{minimal} \usepackage[framed]{matlab-prettifier}%For matlab code \newenvironment{myMP}      {\begin{samepage} \begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting} \end{samepage}} \begin{document} \begin{myMP} matlab word \end{myMP} \end{document}   When I run this with pdflatex it returns a *, indicating that the environment wasn't closed properly.  Thanks! I want to use VBScript to catch errors and log them (ie on error "log something") then resume the next line of the script.  For example,   On Error Resume Next 'Do Step 1 'Do Step 2 'Do Step 3   When an error occurs on step 1, I want it to log that error (or perform other custom functions with it) then resume at step 2. Is this possible? and how can I implement it?  EDIT: Can I do something like this?   On Error Resume myErrCatch 'Do step 1 'Do step 2 'Do step 3  myErrCatch: 'log error Resume Next How do I stop mod_rewrite from appending links to url? Metrizability of Hausdorff continuous image of compact metric space Let $f$ be a continuous mapping of a compact metric space $(X, d)$ onto a Hausdorff space $(Y, \tau_1)$. Then $(Y, \tau_1)$ is compact and metrizable.   In one proof the following metric is constructed:  $d_1(y_1, y_2) = inf\{d(a, b) : a \in f^{-1}\{y_1\},\ b \in f^{-1}\{y_2\}\}$, for all $y_1$ and $y_2$ in $Y$.  I'm thinking about how to prove that triangle inequality holds for $d_1$, s.t. $d_1(x, z) \leq d_1(x, y) + d_1(y, z)$  And how about the case when triangle inequality does not hold?    Update: @daniel-schepler suggested to use metric $d_1(x, y) = inf\{d(x^*, x_1) + d(y_1, x_2) + \cdots + d(y_{n-1}, x_n) + d(y_n, y^*)\}$ where $f(x^*) = x$, $f(y^*) = y$, and $f(x_i) = f(y_i)$ for each $i$.  Now we need to prove 3 property of metric: positivity, symmetry and triangle inequality. This is my sketch:   Positivity. Chose two points $x,y \in Y$ s.t. $x \neq y$. Singleton sets $\{x\}$ and $\{y\}$ are disjoint closed sets by Hausdorfness of $Y$ and their preimages are also disjoint closed in $X$ by continuity of $f$. $X$ is compact metric space by hypothesis and therefore a normal space. In normal space every two disjoint closed sets have disjoint open neighborhoods. Let $f^{-1}(x) \subseteq U$ and $f^{-1}(y) \subseteq V$ s.t. $U,V$ are open and $U \cap V = \varnothing$. Therefore there exists an $\varepsilon &gt; 0$, s.t. $x^* \in B_\varepsilon(x^*) \subseteq U$ and $y^* \in B_\varepsilon(y^*) \subseteq U$ and distance between any two closed sets is strictly positive and $d_1$ is positive and zero iff $x = y$. Symmetry. Clearly $d_1$ is symmetric. Triangle inequality. For triangle inequality we can show that in the "worst" case $d_1(x, z) = d_1(x,y) + d_1(y, z)$. How to merge vertices in Blender? I am attempting to create my first 3D character just for practice. Being one of my first 3d models I going through the learning curve needless to say. In doing so I find myself creating many extra vertices. Where we will say 10 vertices on a rounded shape are spaced out on the equator and on the other north pole end of the edges they are very close. The close end could all be one vertex. Is it possible to say merge all points to one point and delete the rest? Resampling GeoTIFF images to same resolution using QGIS I have two geotiff images that I would like to resample the same resolution. If I use ArcGIS Desktop this is easy to do but how do I do this using QGIS? How can I run ssh-add automatically, without a password prompt? I want to communicate between several computers on my network (static Ethernet), through SSH. In order to do that I need to run ssh-add every time I log in on a specific machine, how can I do it so that it's set up once and it doesn't ask me for the passphrase every time I log in or reboot my machine?  I know that there is a way that you should add some lines to the bash_profile file, but I still need to type the password every time I reboot/log in to a specific machine.  if [ -z "$SSH_AUTH_SOCK" ] ; then     eval `ssh-agent -s`     ssh-add fi I bought a three months membership for PlayStation Plus some time ago. This membership has already expired. While it was active, I got the classic PSOne Resident Evil titles for free. Will I be able to re-download them now without having to purchase a new PSPlus membership? Change the Python3 default version in Ubuntu I am using Ubuntu 16.04 LTS . I have python3 installed. There are  two versions installed, python 3.4.3 and python 3.6 . Whenever I use python3 command, it takes python 3.4.3 by default. I want to use python 3.6 with python3. python3 --version shows version 3.4.3 I am installing ansible which supports version &gt; 3.5 . So, whenever, I type ansible in the terminal, it throws error because of python 3.4 sudo update-alternatives --config python3 update-alternatives: error: no alternatives for python3 At the start of Harry Potter and the Philosopher's/Sorceror's Stone Voldemort's Killing Curse backfires      due to Lily's sacrifice protecting Harry from Voldemort.   leaving Harry with his scar      and a loose piece of Voldemort's soul   and Voldemort as a loose soul, self-described as "Less than a ghost".  Voldemort was not dead, but had no physical body (until he got better in book 4).  What happened to his body?  Did it disappear?  Or was it left in the rubble of the house, alongside the bodies of James and Lily? Notify close voters when a closed question gets edited As mentioned in , a question closed because it was not well-phrased is currently very unlikely to be reopened after an edit clarifying the issues. Those who voted to close should at least be asked to reconsider and reopen the question after such an edit. For what powers $k$ is the polynomial $n^k-1$ divisible by $(n-1)^2$? How do you prove this?  $$\left(n-1\right)^2\mid\left(n^k-1\right)\Longleftrightarrow\left(n-1\right)\mid k$$ martingale and stochastic Integral "Forgot" vs "Forget" Is the following correct, or is there more to it?  "I forgot his name" — I knew his name, but I forgot it.  "I forget his name" — I keep forgetting his name. Where using "forget" basically means that you tried to remember this information before as well, but you couldn't then either. How can I scale all images in a folder to the same width? I want to scale all images in a given folder to the same width (but different appropriately scaled heights). How can I do this using  a GUI-based or command-line tool?  For bonus points, is it possible to restrict which images are scaled based on their initial width (that is, only scale images that have a width > x and/or a width &lt; y)? Suppose $f(x)$ is linear i.e. $f(x + y) = f(x) +f(y) $ and monotone on $[-\infty, +\infty]$, then $f(x) = ax$, a real. Suppose $f(x)$ is linear i.e. $f(x + y) = f(x) +f(y) $ and monotone on $[-\infty, +\infty]$, then $f(x) = ax$, a real.  We know $f(0)=0$, and if one assumes differentiability it is quite easy.      But how does monotone make up for differentiability? Bound states of the $V(x)=\pm \delta'^{(n)}(x)$ potential? The $\delta(x)$ Dirac delta is not the only "point-supported" potential that we can integrate; in principle all their derivatives $\delta', \delta'', ...$ exist also, do they?  If yes, can we look for bound states in any of these $\delta'^{(n)}(x)$ potentials? Are there explicit formulae for them (and for the scattering states)?  To be more precise, I am asking for explicit solutions of the 1D Schroedinger equation with point potential,  $$- {\hbar^2 \over 2m} \Psi_n''(x) + a \  \delta'^{(n)}(x) \Psi(x) \ = E_n \Psi_n(x) $$  I should add that I have read at least of three set of boundary conditions that are said to be particular solutions:   $\Psi'(0^+)-\Psi'(0^-)= A \Psi(0)$ with $\Psi(0)$ continuous, is the zero-th derivative case, the "delta potential". $\Psi(0^+)-\Psi(0^-)= B \Psi'(0)$ with $\Psi'(0)$ continuous, was called "the delta prime potential" by Holden. $\lambda \Psi'(0^+)=\Psi'(0^-)$ and $\Psi(0^+)=\lambda\Psi(0^-)$ simultaneusly, was called "the delta prime potential" by Kurasov   The zero-th derivative case, $V(x)=a \delta(x)$ is a typical textbook example, pretty nice because it only has a bound state, for negative $a$, and it acts as a kind of barrier for positive $a$. So it is interesting to ask for other values of $n$ and of course for the general case and if it offers more bound states or other properties. Is it even possible to consider $n$ beyond the first derivative?  Related questions  (If you recall a related question, feel free to suggest it in the comments, or even to edit directly if you have privileges for it)  For the delta prime, including velocity-dependent potentials, the question has been asked in   In the halfline $r&gt;0$, the delta is called "Fermi Pseudopotential". As of today I can not see questions about it, but  seems to be the same potential.  A general way of taking with boundaring conditions is via the theory of self-adjoint extensions of hermitian operators. This case is not very different of the "particle in 1D box", question  A general take was the question  A related but very exotic question is  because obviosly the point-supported interacctions have a peculiar scaling  Comments  Of course upgrading distributions to look as operators in $L^2$ is delicate, and it goes worse for derivatives of distributions when you consider its evaluation $&lt;\phi | \rho(x) \psi&gt;$. Consider the case $\rho(x) = \delta'(x) = \delta(x) {d\over dx}$. Should the derivative apply to $\psi$ only, or to the product $\phi^*\psi$? Changing permissions on serial port