aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples/rosetta/special_factorial.bruijn
diff options
context:
space:
mode:
authorMarvin Borner2024-03-25 18:59:03 +0100
committerMarvin Borner2024-03-25 18:59:48 +0100
commit14e38ce378236cf54924b58396168c1e94f8e6b2 (patch)
treeecbbb75517695de8897a2a9c58aa1a97ec2546f5 /samples/rosetta/special_factorial.bruijn
parentf8398804d351667a7b887b89f6f70c7d5c407d22 (diff)
Improved samples by adding links to problems
Diffstat (limited to 'samples/rosetta/special_factorial.bruijn')
-rw-r--r--samples/rosetta/special_factorial.bruijn40
1 files changed, 0 insertions, 40 deletions
diff --git a/samples/rosetta/special_factorial.bruijn b/samples/rosetta/special_factorial.bruijn
deleted file mode 100644
index 588a95f..0000000
--- a/samples/rosetta/special_factorial.bruijn
+++ /dev/null
@@ -1,40 +0,0 @@
-:import std/Combinator .
-:import std/List .
-:import std/Math .
-
-factorial [∏ (+1) → 0 | [0]]
-
-superfactorial [∏ (+1) → 0 | factorial]
-
-hyperfactorial [∏ (+1) → 0 | [0 ** 0]]
-
-alternating-factorial y [[=?0 0 ((factorial 0) - (1 --0))]]
-
-exponential-factorial y [[=?0 0 (0 ** (1 --0))]]
-
-:test ((factorial (+4)) =? (+24)) ([[1]])
-:test ((superfactorial (+4)) =? (+288)) ([[1]])
-:test ((hyperfactorial (+4)) =? (+27648)) ([[1]])
-:test ((alternating-factorial (+3)) =? (+5)) ([[1]])
-:test ((exponential-factorial (+4)) =? (+262144)) ([[1]])
-
-invfac y [[[compare-case 1 (2 ++1 0) (-1) 0 (∏ (+0) → --1 | ++‣)]]] (+0)
-
-:test ((invfac (+1)) =? (+0)) ([[1]])
-:test ((invfac (+2)) =? (+2)) ([[1]])
-:test ((invfac (+6)) =? (+3)) ([[1]])
-:test ((invfac (+24)) =? (+4)) ([[1]])
-:test ((invfac (+120)) =? (+5)) ([[1]])
-:test ((invfac (+720)) =? (+6)) ([[1]])
-:test ((invfac (+5040)) =? (+7)) ([[1]])
-:test ((invfac (+40320)) =? (+8)) ([[1]])
-:test ((invfac (+362880)) =? (+9)) ([[1]])
-:test ((invfac (+3628800)) =? (+10)) ([[1]])
-:test ((invfac (+119)) =? (-1)) ([[1]])
-
-seq-a [((superfactorial 0) : ((hyperfactorial 0) : {}(alternating-factorial 0)))] <$> (iterate ++‣ (+0))
-
-seq-b exponential-factorial <$> (iterate ++‣ (+0))
-
-# return first 10/4 elements of both sequences
-main [(take (+10) seq-a) : {}(take (+5) seq-b)]