scoping Questions

2

Solved

I'm lost. How might I pass a loop variable to an AJAX .done() call? for (var i in obj) { $.ajax(/script/).done(function(data){ console.log(data); }); } Obviously, if I were to do console.log(i+...
Debt asked 7/4, 2012 at 23:32

3

Solved

I am trying to find the optimal "lambda" parameter for the Box-Cox transformation. I am using the implementation from the MASS package, so I only need to create the model and extract the lambda. ...
Passover asked 27/9, 2016 at 15:17

0

Can someone give me explanation for the below sentence highlighted in Bold. "Primitive functions are only found in the base package, and since they operate at a low level, they can be more efficie...
Irrepressible asked 2/7, 2016 at 9:0

1

Solved

I want to determine whether an object exists inside a function in R: foo <- function() { y <- "hello" if (exists(y, envir = sys.frame())) print(y) } foo() Error in exists(y, env...
Compelling asked 26/5, 2016 at 22:21

4

Solved

In the typescript function below, 'this' doesn't resolve to the instance of EmailValidator. How can I correct this function so it resolves to the correct instance of EmailVaildator and in turn, so ...
Sidonius asked 18/5, 2016 at 0:32

2

Solved

After running: x <- as.name("aa") aa <- 2 in R, why doesn't (x) return 2? And why doesn't x <- as.name("aa") aa <- 3 get(get(x)) return 3? I know get() expects a string, bu...
Saberhagen asked 6/5, 2016 at 0:44

1

Solved

Say you have this code in a module called Module1: Option Explicit Private Type TSomething Foo As Integer Bar As Integer End Type Public Something As TSomething In equivalent C# code if you ...
Jakoba asked 23/3, 2016 at 20:2

2

I am following a tutorial in Rbloggers and found the use of double colons, I looked online, but I couldn't find an explanation for their use. Here is an example of their use. df <- dplyr::data...
Arhat asked 6/2, 2016 at 12:27

1

Solved

I'm having some issues with scoping in JavaScript when generating a function from within a loop. What I Want: The way I want this to work is a for loop that for each iteration, generates a...
Letourneau asked 28/12, 2015 at 17:47

0

I'm working in RStudio on a simple analysis where I source some files via the source command. For example, I have this file with some simple analysis: analysis.R # Settings ----------------------...
Asceticism asked 12/11, 2015 at 12:49

1

Solved

#include <stdio.h> class C { public: static int i; static int j; }; int i = 10; int C::i = 20; int C::j = i + 1; int main () { printf("%d", C::j); return 0; } What is the value o...
Silencer asked 2/9, 2015 at 20:53

2

Solved

EDIT: Looks like this is a very old "bug" or, actually, feature. See, e.g., this mail I am trying to understand the Python scoping rules. More precisely, I thought that I understand them but then...
Overtask asked 29/3, 2015 at 18:48

3

Solved

I can't seem to get my head around a specific case of scoping for JavaScript variables. Different from other examples and questions I have found, I am interested in the scoping for nested functions...
Supertanker asked 23/2, 2013 at 23:23

3

Solved

I keep trying to find answers for this but fail to do so. I wanted to know, what is the do-end block actually used for? It just says values are used when needed in my book so how could I use this? ...
Zita asked 27/5, 2014 at 17:22

3

Solved

I am still struggling with R scoping and environments. I would like to be able to construct simple helper functions that get called from my 'main' functions that can directly reference all the vari...
Donaugh asked 27/5, 2014 at 13:17

2

Solved

i am very new to MongoDB and NoSQL in general and i've just started building a site with MongoDB / Norm / ASP.NET MVC 3. I am wondering how i should be scoping the connections to my Mongo database...
Opisthognathous asked 7/2, 2012 at 7:16

1

Solved

At http://shiny.rstudio.com/articles/scoping.html the rules for scoping in shiny are well explained. There are 3 environments or levels nested inside each other: objects available within a function...
Klug asked 1/5, 2014 at 14:2

1

Solved

I'm writing some R functions that employ some useful functions in other packages like stringr and base64enc. Is it good not to call library(...) or require(...) to load these packages first but to ...
Meson asked 23/4, 2014 at 0:38

1

Solved

Minimal example class foo: loadings = dict(hi=1) if 'hi' in loadings: print(loadings['hi']) # works print({e : loadings[e] for e in loadings}) # NameError global name 'loadings' not defined...
Resent asked 1/4, 2014 at 14:36

1

Solved

In C++1y, it is possible for a function's return type to involve locally defined types: auto foo(void) { class C {}; return C(); } The class name C is not in scope outside the body of foo, so ...
Ozell asked 13/3, 2014 at 16:24

1

Solved

I'm wanting to run through a long vector of potential explanatory variables, regressing a response variable on each in turn. Rather than paste together the model formula, I'm thinking of using re...
Lehrer asked 30/6, 2013 at 23:18

1

Solved

The title basically says it all. If I do this ... makeActiveBinding("x", function() runif(2), .GlobalEnv) x # [1] 0.7332872 0.4707796 x # [1] 0.5500310 0.5013099 ... is there then any way for m...
Tzong asked 17/4, 2013 at 20:21

1

Solved

This is ALMOST the same as every other this scoping question I have read so far other than one slight difference which makes it relevant (imo) to ask this question. Now originally my problem was s...
Tomasatomasina asked 10/4, 2013 at 12:13

3

So I know that in Scheme define is for dynamic scoping and let for static scoping, yet the following thing confuses me: If I have (let ((x 0)) (define f (lambda () x)) (display (f)) (let ((x 1...
Monolatry asked 18/2, 2013 at 23:6

2

Solved

So I've seen lots of discussion on SO about using erb in your CSS files. I can get ERB to process the CSS files by using the <%= %> syntax and adding .erb to the file, but what I really need is ...
Sokol asked 19/12, 2012 at 1:11

© 2022 - 2024 — McMap. All rights reserved.