pass-by-name Questions
6
Solved
I'm trying to understand the conceptual difference between call by reference, value, and name.
So I have the following pseudocode:
foo(a, b, c)
{
b =b++;
a = a++;
c = a + b*10
}
X=1;
Y=2;
Z=3...
Alfaro asked 5/4, 2013 at 0:15
1
Solved
I'm attempting to chain Iterators:
var it = Iterator(1)
it.next
it = Iterator(2) ++ it
it.next
it.hasNext
This infinitely loops on the hasNext as you can see here: https://scastie.scala-lang.org...
Dibucaine asked 15/5, 2020 at 22:30
4
Solved
I am going through the book "Functional Programming in Scala" and have run across an example that I don't fully understand.
In the chapter on strictness/laziness the authors describe the construct...
Faggoting asked 30/10, 2014 at 21:1
3
Solved
In python we can do this:
def myFun1(one = '1', two = '2'):
...
Then we can call the function and pass the arguments by their name:
myFun1(two = 'two', one = 'one')
Also, we can do this:
de...
Hulbig asked 25/2, 2013 at 19:25
8
Solved
I've checked Wikipedia and googled but I still can't wrap my mind around how pass-by-name works in ALGOL 60.
Balough asked 8/5, 2009 at 3:16
1
Solved
Imagine I have the following class definition:
class Foo[T]
and I want to do the following
def bar(x:Foo[ =>Int ]):Int = ???
But compiler fails with "no by-name parameter type allowed here...
Valenevalenka asked 16/11, 2012 at 12:0
2
Solved
Given this Scala code:
object test {
def byval(a: Int) = println("Int")
def byval(a: Long) = println("Long")
def byname(a: => Int) = println("=> Int")
def byname(a: => Long) = print...
Chadburn asked 1/12, 2010 at 14:0
13
Solved
Lets say I know a guy who is new to C++. He does not pass around pointers (rightly so) but he refuses to pass by reference. He uses pass by value always. Reason being that he feels that "passing ob...
Quark asked 12/9, 2010 at 14:15
1
© 2022 - 2024 — McMap. All rights reserved.