Questions tagged [call-by-need]

6 questions
21
votes
0 answers

Haskell: How "cache" friendly is Lazy Eval / call by need

I have been studying Haskell in my spare time for a couple of months now. I'm wondering how Haskell performs on the current stock hardware, in regards to the memory sub-system (L1, L2, L3 cache). Can someone please point me to any report/study on…
user3169543
  • 1,257
  • 1
  • 8
  • 16
19
votes
3 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…
5
votes
2 answers

Simple example of call-by-need

I'm trying to understand the theorem behind "call-by-need." I do understand the definition, but I'm a bit confused. I would like to see a simple example which shows how call-by-need works. After reading some previous threads, I found out that…
vesii
  • 1,945
  • 8
  • 27
1
vote
1 answer

Call By Need in Scheme

I have this code knowing that parameters are passed using call by need: (define fact-2 (let ((foo (lambda (n f) (if (zero? n) 1 (f n f))))) (lambda (n) (let ((res 1)) (foo n…
1
vote
1 answer

Call-by-need and call-by-name reduction relation semantics

While trying to summarize my knowledge about lambda calculus, I understood that I'm quite familiar with call-by-value but I've never seen сall-by-need reduction semantics. I know the definition, but it would be great to see precise meaning. This is…
vonaka
  • 810
  • 1
  • 9
  • 18
0
votes
0 answers

Counting infix operations executed under call-by-name and call-by-need

Provided the functions (from a lazy functional programming language perspective): fun1(`n0`) = let `n1` = `n0` + `n0` in let `n2` = `n1` + `n1` in ... let x = `nn` + `nn` in x fun2(`n0`) = let…
NewDev90
  • 352
  • 1
  • 10