Questions tagged [evaluation-strategy]

Evaluation strategies determine how and when parts of an expression are evaluated.

What is it?

Evaluation strategies determine how and when parts of an expression are evaluated. Typical examples are eager evaluation, partial evaluation, lazy evaluation.

Related tags

See also:

20 questions
1
vote
1 answer

Infinite random sequence loops with randomIO but not with getRandom

I'm having difficulty trying to figure out a way to reason about why the following two, seemingly equivalent definitions of an infinite random number sequence (inf and inf') are evaluated completely differently: import Control.Monad.Random (Rand,…
Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111
0
votes
2 answers

Evaluate a function one time and store the result in python

I wrote a static method in python which takes time to compute but I want it to compute just one time and after that return the computed value. What should I do ? here is a sample code : class Foo: @staticmethod def compute_result(): …
littleali
  • 408
  • 1
  • 6
  • 22
0
votes
1 answer

What does "top-level evaluation" mean?

What does "top-level evaluation" mean? This term was not defined in the text it was mentioned in. I do not want to tell the specific context, because I am interested only in generic explanations.
user1358
  • 623
  • 2
  • 8
  • 13
0
votes
1 answer

Evaluation Order for Dummies

I can't understand evaluation strategy no matter how much I read the topics. Can you explain the three evaluation orders to me with an example? I am writing a code below. Can you explain call by need(lazy evaluation), call by name (normal order…
jason
  • 6,962
  • 36
  • 117
  • 198
0
votes
0 answers

Call-by-name evaluation and foreach loop

I faced this problem for the first time and I can't figure it out. Let's say we have an array and a foreach loop. Something like this: var v = array(10,20,50); var i = 0 write(foo(v, v[i++])); function foo(ref int[] v, name int y){ foreach(int j…
1
2