diff options
author | Marvin Borner | 2024-03-23 19:18:16 +0100 |
---|---|---|
committer | Marvin Borner | 2024-03-23 19:18:16 +0100 |
commit | 7bfc78b122ad9cbb65eed16f7de4d4021547c2a8 (patch) | |
tree | e45a22aeddb12257a94e32083ed10dfa3a0da66e /samples/euler/009.bruijn | |
parent | fc9980e5e19602748b8cc596cdd07c02ac2889f1 (diff) |
Some Project Euler solutions
Diffstat (limited to 'samples/euler/009.bruijn')
-rw-r--r-- | samples/euler/009.bruijn | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/samples/euler/009.bruijn b/samples/euler/009.bruijn new file mode 100644 index 0000000..be21d9e --- /dev/null +++ b/samples/euler/009.bruijn @@ -0,0 +1,17 @@ +:import std/Combinator . +:import std/Logic . +:import std/Math . +:import std/List . + +# solve' [head <#> lst] +# check (2 + 1 + 0 =? 3) ⋀? ((0 ** (+2)) + (1 ** (+2)) =? (2 ** (+2))) (true : (2 ⋅ 1 ⋅ 0)) {}false +# lst concat-map [concat-map [map [check] ({ (+1) → --0 })] ({ (+1) → --0 })] ({ (+1) → 0 }) + +solve [head <#> lst] → head → tail + check [[[[[2 + 1 + 0 =? 7 (true : (2 ⋅ 1 ⋅ 0)) {}false]]] a b c]] (1 ** (+2)) (0 ** (+2)) + a 1 - 0 + b (+2) ⋅ 3 ⋅ 2 + c 1 + 0 + lst concat-map [map [check] ({ (+1) → --0 })] ({ (+2) → (sqrt 0) }) + +main [solve (+1000)] |