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
28
votes
3 answers

Can Scala call by reference?

I know that Scala supports call-by-name from ALGOL, and I think I understand what that means, but can Scala do call-by-reference like C#, VB.NET, and C++ can? I know that Java cannot do call-by-reference, but I'm unsure if this limitation is solely…
royco
  • 5,409
  • 13
  • 60
  • 84
24
votes
4 answers

How to calculate the mean IU score in image segmentation?

How to compute the mean IU (mean Intersection over Union) score as in this paper? Long, Jonathan, Evan Shelhamer, and Trevor Darrell. "Fully Convolutional Networks for Semantic Segmentation."
hkcqr
  • 251
  • 1
  • 2
  • 5
21
votes
4 answers

What is call-by-need?

I want to know what is call-by-need. Though I searched in wikipedia and found it here: http://en.wikipedia.org/wiki/Evaluation_strategy, but could not understand properly. If anyone can explain with an example and point out the difference with…
7
votes
3 answers

Does call-by-sharing and call-by-reference differ only while multithreading?

If a function is called using Call-by-Reference, then any changes made to the variable inside the function are affected immediately to the caller. And for Call-by-Sharing, it is affected at the end of the function. Question 1: Does Java uses…
Shashwat
  • 2,538
  • 7
  • 37
  • 56
6
votes
5 answers

Are call-by-value and pass-by-value synonymous?

I always thought call-by-value and pass-by-value were synonymous. However, I recently heard someone refer to them as if they were different. Are they the same thing? I'm also talking about their corresponding by-reference terms too.
royco
  • 5,409
  • 13
  • 60
  • 84
6
votes
1 answer

lambda calculus, normal order, normal form,

In lambda calculus, if a term has normal form, normal order reduction strategy will always produce it. I just wonder how to prove the above proposition strictly?
c21
  • 231
  • 3
  • 7
5
votes
2 answers

How to do non short circuit condition in Typescript?

How to evaluate condition in non short circuit way in typescript? Typescript does not allow & or | for boolean type. The reason why I need a non short circuit checking is I call showErrors in function isValueValid. Given this function function…
jmvtrinidad
  • 3,347
  • 3
  • 22
  • 42
3
votes
2 answers

Non-strict by-name arguments in Python?

Question Is there any way to declare function arguments as non-strict (passed by-name)? If this is not possible directly: are there any helper functions or decorators that help me achieve something similar? Concrete example Here is a littly…
Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
2
votes
1 answer

How am I misunderstanding call-by-need evaluation?

First of all, I never studied these things or anything, so I may be asking very silly questions, which I am sorry for, but please go easy on me :) I'm playing around with implementing lambda calculus, with call-by-need evaluation. I'm trying to…
2
votes
3 answers

If perl is call-by-reference why does this happen?

I've read that perl uses call-by-reference when executing subrutines. I made a simple piece of code to check this property, but it behaves like if perl was call-by-value: $x=50; $y=70; sub interchange { ($x1, $y1) = @_; $z1 = $x1; $x1…
1
vote
0 answers

MACD Sample Expert Advisor in MetaTrader4 doesn't work

The simple question is: Why doesn't MACD Sample work? I wanted to use MACD sample EA (I mean the one which is provided by default in MetaTrader) to see if a MACD parameter works or not. I put my desired parameter in this part, instead of…
1
vote
1 answer

What is the evaluation strategy (eager, lazy, ...) of C++ metafunctions such as std::conditional?

C++14 draft n4140 reads T shall be an enumeration type for template struct underlying_type. How bad is it to write std::conditional_t::value, std::underlying_type_t, foo> when T can be an arbitrary type? Will I step…
1
vote
1 answer

Call by name vs normal order

I know this topic has been discussed several times, but there is something still unclear to me. I've read this question applicative-order/call-by-value and normal-order/call-by-name differences and there is something I would to clarify once and for…
Usr
  • 2,628
  • 10
  • 51
  • 91
1
vote
2 answers

Simple way to count the number of times def f(x) is evaluated?

I am trying to count the number of times that f(x) is evaluated without having to change my code too much, it doesn't seem like it should be very difficult but I can't seem to figure it out. def f (x): f = 12*x**5-45*x**4+40*x**3+5 return…
1
vote
1 answer

Having trouble with a function in Scheme

so i am trying to understand this piece of code, and after staring at it for far too long i decided to ask here if anyone could help me understand how and why it works (define knock-knock (letrec ([dig (lambda (i) (cons (* i…
padawanMiyagi
  • 116
  • 11
1
2