Feb. 23rd, 2009

juan_gandhi: (Default)
Provide an alternate implementation of the following class (a thunk) that uses no conditional logic.
For extra credit, make it thread-safe.
abstract class Thunk<T> {
  private boolean evaluated = false;
  private T value;
  public T get() {
    if (!evaluated) {
      value = compute();
      evaluated = true;
    }
    return value;
  }
  abstract protected T compute();
}


Your solutions welcome.
juan_gandhi: (Default)
Сегодня в кафешке кофе беру, слышу - "Марину" играют, "mi sono inamorato di Marina" - вау! Сто лет не слышал; её пели эти, в узких брючках, с коками и узкими галстучками, на которых моя тётя Лиза даже грозилась их повесить, не нравились ей они.


juan_gandhi: (Default)
Вот есть т.наз. брейкпойнт

debugger;

я типа знаю что он в ie работает (только что не удосужился на этой машине проверить) - но как это так что ни в фаебаге ни в хроме он не делает у меня ни хрена?!

<html><body>
this is just a test
<script>
function println(s) {
document.write(s);
document.write('<br/>');
}
function x() {
println("this is x");
debugger;
println("exiting x");
}

function y() {
x();
}
println('so...');
y();
println('done.');

document.write("hi there
");
</script>
and this is just the end of the tests
</body></html>

Что я тут не так сделал?! Ведь для того и команда, чтобы до загрузки останавливать! Хотя, конечно, в хроме можно перезагрузить, и оно всё найдёт, но...

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 23456
78910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 3rd, 2025 01:23 am
Powered by Dreamwidth Studios