aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples/rosetta
diff options
context:
space:
mode:
Diffstat (limited to 'samples/rosetta')
-rw-r--r--samples/rosetta/hailstone.bruijn2
-rw-r--r--samples/rosetta/least_common_multiple.bruijn8
2 files changed, 9 insertions, 1 deletions
diff --git a/samples/rosetta/hailstone.bruijn b/samples/rosetta/hailstone.bruijn
index 46cf8a2..d98c235 100644
--- a/samples/rosetta/hailstone.bruijn
+++ b/samples/rosetta/hailstone.bruijn
@@ -16,6 +16,6 @@ seq-27 hailstone (+27b)
:test (take (+4) <~>seq-27) ((+1b) : ((+2b) : ((+4b) : {}(+8b))))
all-below-100000 [0 : ∀(hailstone 0)] <$> seq
- seq take (+1000) (iterate ++‣ (+1b))
+ seq take (+99999) (iterate ++‣ (+1b))
main [head (max-by (M.compare ⋔ tail) all-below-100000)]
diff --git a/samples/rosetta/least_common_multiple.bruijn b/samples/rosetta/least_common_multiple.bruijn
new file mode 100644
index 0000000..9a6c08e
--- /dev/null
+++ b/samples/rosetta/least_common_multiple.bruijn
@@ -0,0 +1,8 @@
+:import std/Math .
+
+lcm [[=?1 1 (=?0 0 |(1 / (gcd 1 0) ⋅ 0))]]
+
+:test ((lcm (+12) (+18)) =? (+36)) ([[1]])
+:test ((lcm (+42) (+25)) =? (+1050)) ([[1]])
+
+main [[0]]