Questions tagged [free-variable]

31 questions
2
votes
2 answers

Python - Generate an array where elements are a function of a varying parameter, without building the array each time

TLDR : How can I generate an array whose elements depend on some arbitrary (float) value, k, without having to go through the extremely time-expensive process of constructing the array from scratch every time I change the value of k. What I want to…
MrTLane
  • 21
  • 4
2
votes
1 answer

How to access a FREE variable of a function from outside

Let's consider we have a function and an inner function like this (which we can not change): from functools import wraps def outer_f(some_callable): def inner_f(v): return some_callable(v) + 1 return inner_f And we only obtain a…
functure
  • 23
  • 4
1
vote
1 answer

Formal parameters and free variables in dynamic scoping

I'm somewhat confused regarding dynamical scoping, specifically what happens when a formal parameter and a free variable share a name. For example (define x 1) (define f (lambda (x) x) ) (f 2) If this code is compiled and evaluated using dynamic…
1
vote
2 answers

Does hoisting takes place at once for the full code or by nested-function-levels

Hy guys. I dont understand something regarding the hoisting and it can be it is my bad, but I didnt find any answer, neather here nor on google, thatswhy I ask, thanks for reading. So I dont understand, As the javascript engine gets my code below…
1
vote
1 answer

Copy term with variables without variables being bound

With SWI-Prolog. How can a term with variables be copied without the variables being bound? What I have tried I tried copy_term/2 and duplicate_term/2 For example: foo(c). foo(E) :- E = bar(a,b,X), copy_term(E,Ec), …
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
1
vote
2 answers

Binding time of free variables of quoted terms in Scheme

I try to understand how works the quote phenomenon in Scheme. In particular, I would like to understand when are bound free variables of quoted terms. For instance, when I write (define q 'a) (define a 42) (eval q) it returns 42. Thus I deduce that…
abitbol
  • 487
  • 4
  • 8
1
vote
1 answer

Haskell - determine set of free and bounded variables of a function

I have to determine the set of free and bounded variables of the function s1 and s2: s1 := \x -> if y then \z -> (x \y -> y) else (\z -> w) x So, for s1 I'll write: FV(s1):= FV (y) ∪ FV (x) ∪ FV (w) Am I correct? Or should it be: FV(s1):= FV (y) ∪…
John
  • 429
  • 3
  • 8
  • 20
1
vote
3 answers

List free variables in an EL expression

I have an application which contains some EL evaluation used for programmatic configuration. Given an EL expression I want to get what free variables it contains without actually evaluating it. The intention is to provide a UI where end users can…
Saintali
  • 4,482
  • 2
  • 29
  • 49
1
vote
1 answer

Free variables in Coq

Is there any function/command to get/check if a free variable, lets say n:U, exists in a term/expression e, using Coq? Please share. For example, I want to state this "n does not occur in the free names of e" in Coq. Thanks, Wilayat
Khan
  • 303
  • 2
  • 14
0
votes
1 answer

How to define a free variable

I am currently reading the book Fluent Python - Luciano Ramalho (a great book IMO). In the chapter about decorators and closures, there is a following piece of code: def make_averager(): series = [] def averager(value): …
ViM
  • 3
  • 1
0
votes
1 answer

C#, is MultiThread Lambda using free variable Valid?

I want to use some free variables in MultiThread Lambda expression. Here is example, { int a = 0; Thread t = new Thread(() => { SomeBlockingFunc(a); }); t.Start(); } I can't recognize when Thread t Excute, even variable…
Retalia K
  • 64
  • 9
0
votes
1 answer

sympy TypeError: cannot determine truth value of Relational

I am running this git repo code which is supposed to run out of the box with no error (new repo). So, I am not sure why I get this error. I have not change the original code and I am using the same exact dataset as the DJ-RN repo…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
0
votes
2 answers

Loose late binding v. strict late binding

While reading Python’s Execution model documentation, I realized that Python’s free variables do not seem to have a strict late binding property where a name binding occurring in any code block can be used for name resolution. Indeed, executing: def…
Géry Ogam
  • 6,336
  • 4
  • 38
  • 67
0
votes
0 answers

Prolog returns numbers instead of words

I'm trying to get a value returned through the variable A such as loves, however I'm getting a result like _382 instead. Here's the query: ?- checksyn(likes,Result). I would want Result to return loves, not _628. Is it not binding? I'm not…
Joseph
  • 120
  • 9
0
votes
1 answer

Difference between "free variable" and "free occurrence of a variable" in context of lambda calculus

Is there any difference between free variable and free occurrence of a variable in context of lambda calculus? If yes, then please explain with an example or two. Actually I was going through the conversion rules for lambda expression where I came…