# Questions tagged [variable-binding]

The tag has no usage guidance.

40 questions
Filter by
Sorted by
Tagged with
47 views

### What is a simple explanation and example of de Bruijn indices?

In order to find the recurrence formula for the number of λ-terms of a given size, we make use of the representation of variables in λ-terms by de Bruijn indices. Recall that a de Bruijn index is a ...
61 views

### Free variable in the programming language

From the wikipedia of Free variables and bound variables In computer programming, the term free variable refers to variables used in a function that are neither local variables nor parameters of that ...
• 208
1 vote
65 views

### (how) is assignment or binding possible in purely functional languages?

i can't seem to find much info on the following question: how (if at all) is the fixing of names to values (by binding or assignment) possible in a purely functional system like the lambda calculus? i'...
• 11
32 views

### How are closures supposed to interact with variable binding and resolving?

I am currently reading the Crafting Interpreter book and I have a question about the Resolving and Binding chapter The author gave this example to illustrate the problem with the implementation at ...
• 145
57 views

### Lambda calculus with unordered application

In lambda calculus, $\lambda xy.\phi$ isn't in general equivalent to $\lambda yx.\phi$. However, it seems possible to imagine a calculus which replaces application with something like specification, ...
• 241
1 vote
184 views

### What actually IS lambda calculus and how do I actually apply it?

Trying to wrap my head around lambda calculus but am really clueless right now. First of all, I'm really confused WHAT it's actually supposed to be. I've found these definitions: Lambda calculus (...
• 19
1 vote
83 views

### Shallow Binding with static scope, is it possible?

I'm new in programming, I'm currently studying programming languages. I'm trying to implement Shallow Binding with static scope, starting from an abstract syntax (producing a programming language ...
1 vote
141 views

### What attributes are bound statically vs dynamically [closed]

I am having a hard time understanding the concept of what attributes get bound statically instead of dynamically. Below is code and from that code, what gets bound statically? Here is an example (In ...
• 113
101 views

### Lemma relating variable substitution to de Bruijn substitution

Notation: Let $t$ and $u$ be terms in the $\lambda$-calculus, and $x$ be a variable name. Let $[x\mapsto u]t$ be the substitution in $t$ of free variable $x$ for the term $u$. Specifically, I'm ...
334 views

### What benefits are obtained by allowing the occurrence of free variables and open terms in lambda calculus?

Because of the existence of free variables in lambda calculus, the evaluation of open terms (at least as outlined here) is more complicated relative to the evaluation of closed terms since the ...
• 111
37 views

### formal definition of lexical scope

I wonder if there is a formal definition of lexical scope so that people can prove things with respect to it, for example, that an interpreter implements lexical scope. You may ask what level of ...
• 781
92 views

### Semantics of "write-once" variables for complex data structures

Question My use case for what is described below is not a language or compiler implementation, but finding a reasonable semantics for this feature in a an abstract calculus. Ideally, you give me a ...
• 370
359 views

### Difference between assignment, binding, and substitution?

I am trying to understand the difference of assignment, binding, and substitution. I know the three things are related, but to me it's not exactly clear what word refers to what. Example, illustration,...
• 221
31 views

### Does hiding variables work in terms of blocks or line-by-line?

Let's assume I have the following code: declaration of a declaration of b ..a..b { ..a..b declaration of a declaration of b ..a } In this code {} ...
1 vote
71 views

### How to use dynamic scope?

I have this example code, which is an undefined language. We want to know what will be printed if we use static versus dynamic scope. ...
• 367
1 vote
67 views

### Is there a good way to hash abstract binding trees?

The hash function should be invariant under alpha-renaming. Using de Bruijn notation seems to be possible, but it requires alpha-converting the whole tree when a binding is created, and has the ...
• 170
165 views

### Is there a systematic way to know when to alpha-transform free variables?

So, using Church numerals, we define $3 = {\lambda} f. {\lambda}x.f(f(f(x)))$, and $4 = {\lambda} f. {\lambda}x.f(f(f(f(x))))$. We can then add with an expression like $3\ g\ (4\ g\ z)$ And ...
• 1,710
13 views

### Relating indexes for parameters and variables

I am trying to solve a referee assignment problem, but I simply can't think of a way to relate my variable to one of the parameters, and I hope that someone in here can help. I have the following ...
• 45
361 views

### Is the $x$ in $\frac{\mathrm{d}}{\mathrm{d}x}$ a symbol in the sense of Harper's PFPL?

The role of $x$ in $\frac{\mathrm{d}}{\mathrm{d}x} y$ not only confuses my calculus students, it has also puzzled some well known mathematicians. Questions one might ask are: Does the $x$ in the ...
124 views

### How shall I resolve a nonlocal name in a language with deep binding?

From Programming Language Pragmatics by Scott, Figure 3.14 Deep binding in Python. At right is a conceptual view of the run-time stack. Referencing environments captured in closures are shown as ...
• 4,925
420 views

### what are Structural recursion, primitive recursion, recursion combinator and recursion principles?

Recently, I encountered terminologies such as primitive recursion and recursion combinator. One of the sources is here link I googled and read some, but missing the points of them. I know that ...
• 1,014
1 vote
474 views

### When is a variable bound or free in a lambda application?

I am currently reading the book "An Introduction to Functional Programming through Lambda Calculus" (the 2011 edition) and am a bit puzzled by the definitions of free and bound variables ...
• 273
151 views

• 131
2k views

### How do global variables and automatic variables with the same name interact?

Suppose I define a global variable and I define an automatic variable within a function definition with the same name as the aforementioned global variable. What would happen to the global variable ...
4k views

### What is the difference between assignment, valuation and name binding?

I read that Name binding assigns some value (data/code/expression) to an identifier. Assignment and valuation seem to do the same thing. It is confusing. Can I just tell that free variable is one, ...
• 837
488 views

### Is There a Programming Language That Embraces Globals?

All programming languages have globally defined symbols. While best practices invariably abjure their use as mutable entities the philosophy of what is mutable and what is not mutable is highly ...
• 404
628 views

### Free and bound variables

I am familiar with free and bound variables theory , but while learning I somewhere saw this lambda expression ((lambda var ((fn1 var) & (fn2 var))) argument) From what I have learned it ...
• 184
267 views

### Is there a name for the 'scope tree' organization?

I could describe JQuery as a library that allows you to easily select elements on and traverse the DOM, the DOM would be the name of the tree or organizational structure of the HTML. When you are ...
1 vote
357 views

### Interactive example of Dynamic scoping and evaluation order of expressions

Given the following (arbitrary language, although I think it is close to Algol 60) program: ...
830 views

### lexical scoping vs. dynamic scoping

I'm wondering about the result of this program as I get confused when it comes to lexical scoping and dynamic scoping. ...
• 161