scoping Questions
22
Solved
What is a brief introduction to lexical scoping?
Sundae asked 26/6, 2009 at 5:10
16
Solved
I am seeing both of them used in this script I am trying to debug and the literature is just not clear. Can someone demystify this for me?
7
Solved
I just finished reading about scoping in the R intro, and am very curious about the <<- assignment.
The manual showed one (very interesting) example for <<-, which I feel I understood....
Derryberry asked 13/4, 2010 at 10:4
1
I have a VueJS and Cesium project that is having a performance issue in regards to a degradation in frame-rate. I know where the issue is, yet, I don't know why or how to work around it.
export de...
Thomasinethomason asked 1/3, 2020 at 21:28
1
Solved
I have a shiny app with multiple tabs, and I would like to have action buttons within the tabs that allow the user to switch tabs. I found the following pages: https://www.titanwolf.org/Network/q/e...
Sikata asked 25/10, 2021 at 19:14
4
Solved
There are quite a few blog posts (like this) on usages of the standard library functions apply/with/run/also/let available that make it a bit easier to distingish when to actually use which of thos...
Rhizotomy asked 12/1, 2018 at 1:42
1
Solved
This question started with me trying to figure out why symbols created at runtime are not available to EVAL.
outer-EVAL.raku
#!/usr/bin/env raku
use MONKEY-SEE-NO-EVAL;
package Foobar {
our $foo...
3
Solved
I've been trying to get my head around shallow binding and deep binding, wikipedia doesn't do a good job of explaining it properly. Say I have the following code, what would the output be if the la...
Etruria asked 18/11, 2009 at 2:12
1
Solved
I'm a relative newcomer to Julia, and so far I am a fan of it. But coming from years of R programming, some scoping rules leave me perplexed.
Let's take this function. This behaves exactly as I wou...
16
Solved
I just read a great article about JavaScript Scoping and Hoisting by Ben Cherry in which he gives the following example:
var a = 1;
function b() {
a = 10;
return;
function a() {}
}
b();
aler...
Polyclinic asked 21/9, 2011 at 21:23
1
Solved
In Julia 1.4.1, if I define a function in a global scope, modifications after "if false" statements do not affect it, as expected:
test()=0
if false
test()=1
end
println(test())
This prints "0...
2
I am trying to pass on an argument to a function, which is a string but must be evaluated both for it's name (symbol?) and it's value (see example below). So far I am able to use base::get to get t...
Reins asked 13/3, 2020 at 10:27
1
Solved
Given the following function
f <- function(x) {
g <- function(y) {
y + z
}
z <- 4
x + g(x)
}
If one runs the following code in R why is the answer 10? I'm a little confused about...
7
Solved
Are there any libraries for in-browser javascript that provide the same flexibility/modularity/ease of use as Node's require?
To provide more detail: the reason require is so good is that it:...
Haggai asked 7/8, 2011 at 8:20
1
The below works in Python 2 but not 3. Is there a way to access local variables in Python 3? Or an alternative solution to these cases?
[('{name_var}_{i:02d}of{maxpg:02d}.{date_var}').format(i, **...
Clench asked 10/3, 2019 at 3:31
4
Solved
I'd like to give a params argument to a function and then attach it so that I can use a instead of params$a everytime I refer to the list element a.
run.simulation<-function(model,params){
atta...
3
Solved
Given the following code:
msg = "test"
try:
"a"[1]
except IndexError as msg:
print("Error happened")
print(msg)
Can somebody explain why this causes the following output in Python 3?
Er...
Piglet asked 24/10, 2018 at 9:50
3
Solved
I'm trying to use the curve3d function in the emdbook-package to create a contour plot of a function defined locally inside another function as shown in the following minimal example:
library(emdb...
5
Goal
My goal is to define some functions for use within dplyr verbs, that use pre-defined variables. This is because I have some of these functions that take a bunch of arguments, of which many al...
6
Solved
All the crazy Java scoping rules are making my head spin and the public static void nonsense isn't helping matters. So far all the programming languages I have used either lexical scoping or some a...
Tedi asked 31/1, 2011 at 5:54
1
Solved
I have working code, but I am trying to understand why it works. I am also trying to learn more about the internals of Perl 5 (perlbrew, perl-5.26.1, Cygwin x64).
I know from perlvar and strict th...
Dermott asked 9/4, 2018 at 17:48
1
Solved
I'm looking for a way to call a function that is not influenced by other objects in .GlobalEnv.
Take a look at the two functions below:
y = 3
f1 = function(x) x+y
f2 = function(x) {
library(dpl...
Gainsay asked 25/8, 2017 at 21:42
3
Solved
I'm trying to use foreach to do multicore computing in R.
A <-function(....) {
foreach(i=1:10) %dopar% {
B()
}
}
then I call function A in the console. The problem is I'm calling a functi...
Crackerbarrel asked 22/1, 2011 at 0:23
7
Solved
Or more specific to what I need:
If I call a function from within another function, is it going to pull the variable from within the calling function, or from the level above? Ex:
myVar=0;
funct...
Semester asked 6/6, 2009 at 4:16
1
Solved
I have a package foo which contains class FStream. The package object of foo defines a few implicit value classes that provide extender methods for FStream. I would like to move these value classes...
Baerman asked 9/2, 2017 at 4:5
1 Next >
© 2022 - 2024 — McMap. All rights reserved.