Questions tagged [evaluation-strategies]

Evaluation strategies (or reduction strategies) are rules on how to evaluate programs. Common strategy choices include call-by-value (applicative order) vs. call-by-name (normal order) and eager (strict) vs. lazy.

Evaluation strategies (or reduction strategies) are rules on how to evaluate programs. Common strategy choices concern function arguments and include call-by-value (applicative order) vs. call-by-name (normal order) and eager (strict) vs. lazy.

35 questions
18
votes
2 answers

Is it possible for a stack-based programming language to be concurrent?

I have been reading about stack-based programming languages, such as FORTH and Cat, and it seems that given their nature, they can only execute one action at a time regardless of their paradigm (FORTH is imperative whereas Cat is functional). An…
Joan Vene
  • 195
  • 1
  • 8
15
votes
1 answer

Difference between normal-order and applicative-order evaluation

The language I'm learning is Scheme and I'm working on an exercise that gives this: (define (p) (p) ) (define (test x y) (if (= x 0) 0 y)) Then the question asks to evaluate the…
7
votes
3 answers

Is Applicative-order and Normal-order evaluation model's definition contradictory as per sicp text book?

As per this explaination, it defines applicative and normal order evaluation in one form saying: This alternative "fully expand and then reduce" evaluation method is known as normal-order evaluation, in contrast to the "evaluate the arguments and…
6
votes
3 answers

Call by value-result vs. call by reference?

From my Googling, it appears that call by value-result is similar to call by reference in that it changes values in the caller, but it's different in that the changes don't take place until the callee exits, and that if the same variable is passed…
4
votes
1 answer

Playing to win strategy algorithm

Here is the game's setup: You're given a formula for a binary expression using and or not as the connectives. The connectives are combining many variables for which two players will assign truth values to them in the order specified beforehand. …
Krio
  • 41
  • 2
4
votes
1 answer

In what cases is graph rewriting not enough to avoid duplicate work?

As I understand, evaluating something like the following in normal order evaluation is inefficient due to duplicate work: double x = (x,x) main = double some_hard_computation I remember someone telling me That there are two ways to avoid this:…
4
votes
1 answer

Why Normalisation by Evaluation needs to use a different representation of programs?

I'm trying to understand NbE (Normalisation by Evaluation). One thing I don't get is why it uses two different representations of programs: a syntactic and a semantic one. All the implementations of NbE I found do this. They all look somewhat…
3
votes
1 answer

How to use Latin hypercube sampling with fixed points?

I use Latin hypercube sampling to select what point to evaluate my function. As evaluations take a lot of time, I want to limit the time by adding already evaluated points. I thought about taking the min distance between the points, and if I have an…
HennyKo
  • 131
  • 3
3
votes
1 answer

Understanding Applicative Evaluation Order with the Z-Combinator

I am trying to understand how the Z-combinator (Y-combinator for applicative order languages) definition came about. As Python is applicative I am using Python for this. So I know Python's evaluation order is applicative. But I seem to be…
3
votes
1 answer

Best algorithm to evaluate a function that takes the elements of all possible combinations of N numbers

Consider a set $A$ containing $N$ real numbers. Let $f(X_{r,k})$ represent a function, where $X_{r,k}\subseteq A$ denotes the $k$th combination of $r$ elements from $A$, with $1 \leq k \leq \binom{N}{r}$ and $0 \leq r \leq N$. What is the most…
3
votes
1 answer

Is the term $(\lambda x.x)(y y)$ a normal form in call-by-value reduction strategy?

I am learning λ-calculus and I have some confusion about it. Is the term $(\lambda x.x)(y y)$ a normal form in call by value reduction strategy? (where $y$ is a free variable) From the wikipedia, it says: Call by value Only the outermost redexes…
chansey
  • 295
  • 1
  • 8
3
votes
0 answers

Standardisation Theorem versus Leftmost reduction Theorem

According to Chris Hankin in his book (Lambda Calculus a Guide for Computer Scientists). A reduction sequence $\sigma: M_0 \to^{\Delta_0} M_1 \to^{\Delta_1}M_2 \to^{\Delta_2}\ldots $ is a standard reduction if for any pair $(\Delta_i,…
2
votes
1 answer

Call by value-return with void function

If I'm passing parameters as call by value-return and call a void function, will the local values within the function still be copied to the corresponding values in the caller function even though the called function doesn't return? For example: int…
2
votes
1 answer

Conditionals with normal order evaluation

From what I've read, conditionals (like the cond statement in lisp) do not need to be primitive if normal order evaluation is used. Using lambda calculus and normal order evaluation, how can you emulate if and cond statements? (cond ( ) …
stephenwebber
  • 232
  • 1
  • 9
2
votes
1 answer

Is there a hierarchy of computational expressivity that is sensitive to evaluation strategies?

Various computational hierarchies describes the relative expressivity of different classes of languages, machines, or other models of computing, with the classic progression for Automata Theory [0] being: Deterministic Finite Automata (DFA) <…
1
2 3