История изменений
Исправление monk, (текущая версия) :
И
(defvar triples
(with-yield
(loop for z from 1 do
(loop for x from 1 to z do
(loop for y from x to z
when (= (+ (* x x) (* y y))
(* z z))
do (yield (list x y z)))))))
явно читабельнее, чем
auto triples =
for_each(iota(1), [](int z) {
return for_each(iota(1, z+1), [=](int x) {
return for_each(iota(x, z+1), [=](int y) {
return yield_if(x*x + y*y == z*z,
make_tuple(x, y, z));
});
});
});
Исходная версия monk, :
И
(defvar triples
(with-yield
(loop for z from 1 do
(loop for x from 1 to (1+ z) do
(loop for y from x to (1+ z)
when (= (+ (* x x) (* y y))
(* z z))
do (yield (list x y z)))))))
явно читабельнее, чем
auto triples =
for_each(iota(1), [](int z) {
return for_each(iota(1, z+1), [=](int x) {
return for_each(iota(x, z+1), [=](int y) {
return yield_if(x*x + y*y == z*z,
make_tuple(x, y, z));
});
});
});