dynamic-scope Questions
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
2
Solved
is there a feautre similar to C macros which lets you reuse code in an inline manner, without creating a seperate scope for that piece of code?
for example:
a=3
def foo():
a=4
foo()
print a
wi...
Cardio asked 3/4, 2020 at 15:45
2
Solved
I was looking in and saw this comment in the indir implementation:
sub indir(Str() $path, $what, :$test = <r w>) {
my $newCWD := $*CWD.chdir($path,:$test);
$newCWD // $newCWD.throw;
{
m...
Fleurdelis asked 31/12, 2016 at 9:1
3
Solved
I found this very helpful SO page while trying to resolve an issue related to macro variable scope.
why doesn't %let create a local macro variable?
So to summarize, writing %let x = [];or %do ...
Manaker asked 21/2, 2016 at 7:2
1
Solved
I want to rebind a special variable inside of a loop. Now, normally, this is accomplished using a let.
(let ((*read-eval* nil))
(do-something-here))
But since the loop macro has these nice with...
Biestings asked 30/10, 2015 at 2:22
2
Solved
I realize the following is a bad idea for many reasons. I also realize that given I have a stackoverflow rep of 23, it's nature to assume that I'm a newb learning to program. However, please humor ...
Watchman asked 8/10, 2012 at 20:56
7
Solved
JavaScript has lexical scoping which means that non-local variables accessed from within a function are resolved to variables present in the parents' scope of that function when it was defined. Thi...
Crossways asked 8/4, 2012 at 6:26
1
Solved
clojure.core has the macros bindings and with-redefs. Looking at the docstrings and the examples on clojuredocs.org, they seem to do something very similar. What is the difference and which one sho...
Nourish asked 22/11, 2013 at 7:34
2
Solved
So I have this problem where I have to figure out the output using two different scoping rules. I know the output using lexical scoping is a=3 and b=1, but I am having hard time figure out the outp...
Amnion asked 24/10, 2013 at 19:14
10
Solved
I've learned that static scoping is the only sane way to do things, and that dynamic scoping is the tool of the devil, and results only from poor implementations of interpreters/compilers.
Then I...
Skywriting asked 26/11, 2008 at 15:4
2
Solved
Emacs 24 now has lexically-scoped variables. It also still has dynamically-scoped variables, of course. Now that it has both, I'm quite confused about when a variable will have which kind of scope....
Latton asked 4/10, 2011 at 22:41
2
Solved
The following emacs lisp file is about seeing what happens when Alice uses a lexically bound local variable foo in her init file and Bob defines foo as a global special variable with defvar in his ...
Craftsman asked 1/7, 2013 at 8:53
4
Solved
The sexp in question is
(((lambda (b)
(lambda (a)
(+ b a))) 3) 5)
which, to me, looks like it should evaluate to 8, and in other lisps (e.g. Racket) it does, but in elisp it instead throws thi...
Kubis asked 14/6, 2013 at 6:2
2
Solved
I had a look at the references: http://clojure.org/vars#Vars%20and%20the%20Global%20Environment, http://clojuredocs.org/clojure_core/clojure.core/binding
as well as clojure and ^:dynamic and Cloju...
Champlin asked 17/10, 2012 at 10:42
1
In Section 3.2.2 of SICP the execution of the following piece of code
(define (square x)
(* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(define (f a)
(sum-of-squares (+ a 1) ...
Trait asked 6/10, 2012 at 21:21
1
Solved
I tried to understand dynamic variables and binding function so I tried this (clojure 1.3):
user=> (defn f []
(def ^:dynamic x 5)
(defn g [] (println x))
(defn h [] (binding [x 3] (g)))
...
Fax asked 30/7, 2012 at 22:49
2
Solved
I think I understand why there is a danger in allowing closures in a language using dynamic scope. That is, it seems you will be able to close the variable OK, but when trying to read it you will o...
Zug asked 10/9, 2010 at 1:17
5
Solved
I'm using dynamic scoping to simulate pointers in JavaScript as follows:
var ptr = (function () {
var ptr = "(" + String(function (value) {
if (value === void 0) return upvalue;
else upvalue = ...
Roughen asked 23/4, 2012 at 13:5
4
Solved
I'm now studying Emacs Lisp from the reference manual and Common Lisp from a LISP Book.
from the Common Lisp book
>> (setf power-of-two
(let ((previous-power-of-two 1))
#'(lambda ()
(set...
Norward asked 5/8, 2011 at 11:29
4
Solved
I am translating some code from lisp to Python.
In lisp, you can have a let construct with the variables introduced declared as special and thus having dynamic scope. (See http://en.wikipedia.org/...
Probst asked 4/1, 2010 at 18:9
1
In my experience, it is rarely/never necessary to set scope="request" on an EL variable.
For example, I have a page that, given an item parameter, constructs a URL specific to that item based on i...
Unmanned asked 28/9, 2011 at 17:18
1
Solved
A list in lisp is a series of cons cells, but in Tcl, a list is a string with whitespace separating the elements. For translating code from lisp to tcl, one might simply take lisp lists and transla...
Rabelaisian asked 9/9, 2010 at 22:21
1
© 2022 - 2024 — McMap. All rights reserved.