I'm trying to figure out monads in Haskell but didn't get too far yet.  I found  and several other tutorials/explanations, but none seems to be explaining the difference between the type constructor and the return function.  As I understood the   type constructor constructs a monad from a given value of the basic data type. So it's sort of a normal constructor like in Java, which builds from the given parameter a new instance. return function applies the type constructor on the given value of the basic data type and returns the constructed monad.   So what's the point of having two functions doing basically the same?  EDIT So using the example of a Maybe-monad, the   country = Just "China": (constructor) creates the monad for the value "China".  return "China": returns the monad which is corresponding to the value of China, so it's basically the monad containing the "China" value.   Generally speaking I understand a monad as a container for values.  One usage of monads is to combine simple/existing computations to more complex computations.
Having briefly looked at Haskell recently, what would be a brief, succinct, practical explanation as to what a monad essentially is?  I have found most explanations I've come across to be fairly inaccessible and lacking in practical detail.
I have often wondered at the practice on Stack&nbsp;Overflow, Server&nbsp;Fault, and the other sites where someone will ask a question and an answer will come in that says Look here: http://link elsewhere. Rarely will the link have exactly the answer necessary -- often it's an entire article -- yet these answers get voted up.  Why is that, exactly? I realize this is subjective, but my own thoughts are that one should try and give the answer (even if the answer is 'no, it can't be done' or 'no, I don't think it can be done' -- very different answers) and then if you have a link that explains it, go ahead and post it within the answer.  What does the community think about this?     For more information, see  in the . No file output after rendering? I usually am able to render successfully to the c:\tmp folder, but when I came into work today, I rendered out the image on my work laptop, and everything seems to work, but I'm not getting an output to the tmp directory.  Does anyone know how to make this work? How is the nature of logical principles commonly defined in contemporary philosophy? In contemporary philosophy, how exactly is the nature of logical principles defined? For example, the way I've commonly seen logical principles construed are as true propositions which described the most general laws of reality. The previous definition does seem very intuitive to me; if we understand logical principles as being concerned with truth, and if we accept a correspondence theory of truth, then logical principles simply describe fundamental laws regarding various states of affairs occurring in reality. (e.g. If state of affairs S1 obtains and state of affairs S2 obtains, then state of affairs S3 must also obtain given logical law L).  However, I've mostly heard the previous view expressed among laypersons. I'm interested to know how most philosophers would think about the nature of logical principles. Can Mjolnir be lifted & wielded by anyone if Thor is touching it? In The Big Bang Theory episode , Penny, Amy, and Bernadette are having an argument if Thor's hammer:   Can be lifted by anyone in space.     Can be lifted &amp; wielded by anyone if Thor is touching it.   The first argument is settled in .  But the second argument remains unsolved.  Can Thor's hammer be lifted &amp; wielded by anyone if Thor is touching it? Suppose $a_0,a_1,a_2$ satisfy the recurrence $a_n = 3a_{n-1}-3a_{n-2}+a_{n-3}$ for $n\ge3$   Let $c_n=a_{n+1}-a_n$ for $n\ge1$ and $c_0=0$   Find a linear recurrence of degree at most 2 for the sequence $c_0,c_1,c_2,...$  I'm not entirely sure what they are asking for but I think it is asking for a recurrence relation for $c_n$ where the characteristic polynomial has degree at most 2.  I tried finding a closed form for $a_n$ to try and get rid of the $a_n$ in the $c_n$ equation, but I can't figure it out when the initial conditions aren't specified ($a_0,a_1,a_2$)  Any help would be appreciated! Nearby objects won't move independently? I'm looking to do a third-party assessment of the false-positive rate of a video classification algorithm. Since I have a lot of video I'm trying to do a power analysis to figure out exactly how much video I need to look through so that it is representative of all the video data at a given confidence interval.  The algorithm flags video sequences that have at least one cat in it, and I'm looking to evaluate the frequency of false positives on a new unlabeled test set. So I have tagged all the video that my algorithm has identified a cat in and now want to sample the tagged video sections and look through them manually to validate my model since looking through all of it would take too long! Note, I'm not looking to refine the model at this point, just assess it.  My null hypothesis is that the FP rate of the sample of video I watch is equal to the FP rate of all the video.   I think I can use this formula to determine the number of video sequences to view:    Here is my question: am I thinking through this formulation correctly? Since my model has a CV false positive rate of ~0.96, I figure I can use that as a reference. Can I use that for the null hypothesis proportion, p0? Or will that be p, the true proportion?    I've been using this online calculator:   I ask because when setting the parameters I have, I'm getting very small sample sizes, like less than 10 sequences to view. That can't be right. I'd like to add an invisible watermark to each PDF document that I produce so that in case it leaks, I know where it leaked from. Anyone knows what would a good way for an invisible watermark be in a PDF document and how to add one? The TweakUI powertoy for Windows XP had an option to auto-login. It stored your password and did the login for you. This was useful, since you kept password protection, but had login programs loaded when you first booted.  When you switched users or hibernated, it would still ask for a password, which is the desired behavior.  Is there a way of doing this in Windows 7? Clerical mistake in UK visa application: should I make a pen-and-ink correction or electronically edit the PDF? I've gone through all similar questions but I believe my specific question doesn't have an answer yet.  I've applied for a Standard Visitor visa. After I completed the application, made an appointment and paid the fee, I noticed that the way I spelled my name on the application differs from how it is spelled in the passport by 1 letter (this is partially because of myself being an idiot, but mainly because my new passport has an incorrect transliteration of my name, whereas my old passport and any other document in my life has the correct one).  So here are the options I see:   Print the application and make a pen-and-ink correction with a black ballpoint pen by crossing the printed name/letter and writing the correct one - as answers to other similar questions suggests. Edit the PDF electronically and print it so that there are no visible corrections. However, as the form is saved at their end, there will be a discrepance between the printed form and saved form with no visible signs of correction.   Which way has better chance for me to have my application accepted?  Also (probably doesn't matter much but still): if it's the pen-and-ink correction, is it better to cross-out the whole name or only the wrong letter? AuraClientService.postProcess: error in processing [RangeError: Maximum call stack size exceeded] - Client Side Action I have a lightning component that is using ui:inputSelect.   The component code:              &lt;div class="slds-form-element__control"&gt;                 &lt;ui:inputSelect class="slds-select" aura:id="quals" change="{!c.getPreCodes}"&gt;                     &lt;aura:iteration items="{!v.questions}" var="q"&gt;                          &lt;ui:inputSelectOption aura:id="question" text="{!q.Id}" label="{!q.Question_Text__c}"/&gt;                     &lt;/aura:iteration&gt;                 &lt;/ui:inputSelect&gt;             &lt;/div&gt;   The controller:      getPreCodes : function(cmp, event, helper){         var selected = cmp.find("quals").get("v.value");          var action = cmp.get("c.getPreCodes");         action.setParams({             "qualID" : selected         });         action.setCallback(this, function(response){             var state = response.getState();             if (state === "SUCCESS") {                  console.log('precodes: ', response.getReturnValue());              }         });          $A.enqueueAction(action);     }   The basic logic is that the uiSelect is dynamically populated on init (this works fine). When a user makes a selection the "change" parameter function is fired to retrieve a list from the database and pass it to another component.   However, the change function {!c.getPreCodes} seems to be called recursively causing a      "Something has gone wrong. AuraClientService.postProcess: error in   processing [RangeError: Maximum call stack size exceeded] . Please try   again."   error. If I comment out the enqueueAction the function only runs once (nothing is called recursively) so I suspect it has something to do with the controller call. For aer.bst, citations with 3 or more authors are listed using et al. I need to modify the bibliography so that citations with 4 or more authors are listed using et al., but that citations with 3 authors have all the names written out. For example, I want "See Adams, Brown, and Clark (2003)" as opposed to "See Adams et al. (2003)." I'm using natbib with LaTex: \usepackage{natbib,har2nat}  In order to do that, I need to modify the function format.lab.names.abbr.  Might someone know how to do this?  FUNCTION {format.lab.names.abbr} { 'name.list :=   name.list num.names$ 'numnames :=   numnames #1 &gt;     { numnames #2 &gt;         { name.list #1 "{vv~}{ll}" format.name$ " et al." * }         { name.list #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =             { name.list #1 "{vv~}{ll}" format.name$ " et al." * }             { name.list #1 "{vv~}{ll}" format.name$ " and " *               name.list #2 "{vv~}{ll}" format.name$ *             }           if$         }       if$       field.used editor.field = {", eds" *} {} if$     }     {         name.list #1 "{vv~}{ll}" format.name$         field.used editor.field = {", ed" *} {} if$     }   if$ }   FUNCTION {format.lab.names.full} { 'name.list :=   #1 'nameptr :=   name.list num.names$ 'numnames :=   numnames 'namesleft :=     { namesleft #0 &gt; }     { name.list nameptr "{vv~}{ll}" format.name$ 'temp :=       nameptr #1 &gt;         { namesleft #1 &gt;             { ", " * temp * }             { temp "others" =                 { " et~al." * }                 { " and " * temp * }               if$             }           if$         }         'temp       if$       nameptr #1 + 'nameptr :=       namesleft #1 - 'namesleft :=     }   while$   numnames #1 &gt; field.used editor.field = and {", eds" *} {} if$   numnames #1 = field.used editor.field = and {", ed" *} {} if$ } Why do some people answer in comments? Why do some people post comments that are actually answers to the question? Wouldn't posting an answer be better? I have already had the same problem before. On that occasion, I found a program that could scan my entire hard drive for string pieces so I could recover it. Unfortunately I don't remember the name of the program. It had to access the hard drive data directly, normal searches won't get any data from the hard drive before formatting. How to secure database passwords in PHP? How to remotely display my Android on my PC? There is a thing which is called miracast, it can mirror the display of the Android phone to another monitor, but my screen doesn't have this function, am I possible to do it in Ubuntu? Why can't we see images reflected on a piece of paper? My 3 years old doesn't tell me when he needs to use the bathroom My son is 3 years old and doesn't tell me when he needs to use the bathroom. It has been 5 months now that I took his diaper off him. I just do not know what I should do.  Should I put a diaper on him again?  I mean, is this normal? Please help. I get frustrated sometimes.  He doesn't want to potty at all! I did train him before but now that he understands, he doesn't want to go to potty. Why can't the indefinite integral $\int\frac{\sin(x)}{x}\mathrm dx$ be found? EM algorithm gaussian mixtures- derivation I'm trying to make sense of a derivation I'm following from the lecture notes of Stanford's ML course.  Specifically the notes are here:   I'm particular I'm interested in the step where they are optimizing the lower bound of the log-likelihood by finding the derivative of that function w.r.t the mean (top of page 7). I'm a bit stuck on going from line 1 to line 2 in that sequence.  To copy here (using abbreviated notation for space):  $$ \nabla \mu_s \sum_{i=1}^{m}\sum_{j=1}^{k} w_j^{(i)}\log\frac{\alpha_j \exp\psi_{j}^{(i)}\phi_j}{w_j^{(i)}}  \qquad(1) $$ $$ \nabla \mu_s \sum_{i=1}^{m}\sum_{j=1}^{k} w_j^{(i)}\psi_{j}^{(i)}\qquad(2) $$ where $\psi_{j}^{(i)} =-\frac{1}{2}(x^{(i)}-\mu_j)^T\Sigma^{-1}_{j}(x^{(i)}-\mu_j)$ and $\alpha_j=\frac{1}{(2\pi)^{n/2}|\Sigma_j|^{1/2}}$.  The quantity $\mu_s$ is the mean (of a multivariate gaussian distribution) for class $s$.    In short, I'm not sure how they get from (1) to (2).  From just changing the log of (1) I see:  $$ \nabla \mu_s \sum_{i=1}^{m}\sum_{j=1}^{k} w_j^{(i)}\log \left(\alpha_j \exp\psi_{j}^{(i)}\phi_j\right) - w_j^{(i)}\log w_j^{(i)} \qquad(1) $$  To get to their form (2) my impression is that they take pre-emptively discard terms that would contain derivatives of $w_j^{(i)}$ (w.r.t. $\mu_s$).  At least if you assume that much, you get to (2).  However, as they show earlier in that PDF,  $$ w_j^{(i)} = p(z^{(i)}=j | x^{(i)}) =\frac{p(x^{(i)}|z^{(i)}=j)p(z^{(i)}=j) }{\sum_j p(x^{(i)},z^{(i)}=j) } $$ i.e. this quantity is the posterior distribution of the class labels.  Intuitively, it seems like $\partial w_j^{(i)}/ \partial \mu_s$ should be non-zero.  After all, changing the location of the mean $\mu_s$ would change your posterior probability for a particular class given the same data.  (Right?).  Just from a mechanical point of view, $\partial w_j^{(i)}/\partial \mu_j$ would seemingly have some non-zero terms since $p(x^{(i)}|z^{(i)}=j) \sim \mathcal{N}(\mu_j, \Sigma_j)$.  If I work through the algebra, I get  $$ \frac{\partial w_j^{(i)}}{\partial \mu_j} = w_j^{(i)}(1-w_j^{(i)})\frac{\partial \psi^{(i)}_{j}}{\partial \mu_j} $$  What am I missing here?  If I take the log-likelihood (without even thinking about EM algorithm),    $$ \ell = \sum_{i=1}^{m}\log \sum_{j=1}^{k}p(x^{(i)}|z^{(i)}=j)p(z^{(i)}=j) $$ and differentiate w.r.t $\mu_s$, I correctly get  $$ \mu_s^* = \frac{\sum_{i=1}^{m}w_s^{(i)}x^{(i)}}{\sum_{i=1}^{m}w_s^{(i)}} $$  so I'm comfortable with the eventual result, just not the intermediate steps.