aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2024-03-21 20:45:15 +0100
committerMarvin Borner2024-03-21 20:45:15 +0100
commita9880a191bbb5eeaf0faef9336263c92ef9351b6 (patch)
tree51401eef0d24fd38f220229da386330fcfc12e1b
parent2065029025c6e53eb550717755996d1d6fc5f60d (diff)
Weird mistakes
-rw-r--r--docs/code.js5
-rw-r--r--std/List.bruijn4
2 files changed, 5 insertions, 4 deletions
diff --git a/docs/code.js b/docs/code.js
index bfeaeb1..71ca75d 100644
--- a/docs/code.js
+++ b/docs/code.js
@@ -1,13 +1,14 @@
// high-quality syntax highlighter
// TODO: Implement actual parser (or fix MANY regex bugs)
+// TODO: bug: -0 in (-0 0) is not highlighted as index
const term = (t) =>
t
.replaceAll(
- /(?<!\([+-]\d*)(?<![a-z][^&; ]*)([0-9])/g,
+ /(?<!\([+-]\d*)(?<![a-z][^&; ]*)(?<!["'])([0-9])/g,
"<span class='index'>$1</span>",
)
- .replaceAll(/'(.)'/g, "<span class='string'>'$1'</span>")
+ .replaceAll(/'([^\'])'/g, "<span class='string'>'$1'</span>")
.replaceAll(/"([^\"]*)"/g, "<span class='string'>\"$1\"</span>")
.replaceAll(/(\([+-][0-9]+[ubtd]?\))/g, "<span class='number'>$1</span>")
.replaceAll(/(?<!\>)(\()/g, "<span class='left-app'>(</span>")
diff --git a/std/List.bruijn b/std/List.bruijn
index a240e3d..488c131 100644
--- a/std/List.bruijn
+++ b/std/List.bruijn
@@ -510,8 +510,8 @@ iterate z [[[rec]]] ⧗ (a → a) → a → (List a)
:test (take (+5) (iterate i (+4))) (take (+5) (repeat (+4)))
:test (take (+0) (iterate ++‣ (+0))) (empty)
-# calculates all fixed points of a given function as a list
-y* [[[0 1] <$> 0] xs] ⧗ a → (List b)
+# calculates all fixed points of given function as a list
+y* [[[0 1] <$> 0] xs] ⧗ (List a) → (List b)
xs [[1 <! ([[1 2 0]] <$> 0)]] <$> 0
:test (&(+5) <$> (y* ([[[=?0 true (1 --0)]]] : {}[[[=?0 false (2 --0)]]]))) (false : {}true)