#A way to postpone the evaluation of equations.

12 messages · Page 1 of 1 (latest)

long snow
#

var n = 3 + 4; // eagerly evaluated var n = delay (3 + 4); // lazily evaluated

System.out.println(n.eval());

What does it look like in Java ?

dapper garnetBOT
#

This post has been reserved for your question.

Hey @long snow! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

topaz linden
#

oh

#

whoops missed the last line completely lol

#

i don't think that's really a thing

#

not in js, either

#

something like that would be inside a getter, it wouldn't exactly be evaluated lazily, just evaluated upon the (deferred) call

#

i guess in java it would be the same, inside a method or supplier

mystic sky
#

just make a method

#
int eval(int a, int b){
  return 3+4;
}
int a=3;
int b=4;
Thread.sleep(1000);
System.out.println(eval(a,b));