Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ez.lock.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ hub = "https://hub.bend-lang.com"
[tools]
[tools.bolt]
git = "https://github.com/Emerging-Patterns/bolt"
rev = "9700daf3a447089a8795d311912014382a74a2a9"
tag = "v1.27.0"
rev = "dfb06d0e5d6362739231b90bb090535af493b8f0"
tag = "v1.65.0"
root = "."
narHash = "sha256-0S48j2dongVcvP5Oms5a+s5I12sIy91KAgwW0bP7pxM="
narHash = "sha256-39sCydxFW7dWmf69CTJOXuC+j884fEhHWFKctdWCkAg="
entry = "main.bend"
6 changes: 3 additions & 3 deletions ez.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ entry = "main.bend"
[tools]
[tools.bolt]
git = "https://github.com/Emerging-Patterns/bolt"
rev = "9700daf3a447089a8795d311912014382a74a2a9"
tag = "v1.27.0"
rev = "dfb06d0e5d6362739231b90bb090535af493b8f0"
tag = "v1.65.0"
root = "."
narHash = "sha256-0S48j2dongVcvP5Oms5a+s5I12sIy91KAgwW0bP7pxM="
narHash = "sha256-39sCydxFW7dWmf69CTJOXuC+j884fEhHWFKctdWCkAg="
entry = "main.bend"
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 18 additions & 34 deletions proofs/IsoHasFixedShape.bend
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,24 @@ def digit_at_shape(k):
match k:
case 0n:
{==}
case 1n+k1:
match k1:
case 0n:
{==}
case 1n+k2:
match k2:
case 0n:
{==}
case 1n+k3:
match k3:
case 0n:
{==}
case 1n+k4:
match k4:
case 0n:
{==}
case 1n+k5:
match k5:
case 0n:
{==}
case 1n+k6:
match k6:
case 0n:
{==}
case 1n+k7:
match k7:
case 0n:
{==}
case 1n+k8:
match k8:
case 0n:
{==}
case 1n+_k9:
{==}
case 1n:
{==}
case 2n:
{==}
case 3n:
{==}
case 4n:
{==}
case 5n:
{==}
case 6n:
{==}
case 7n:
{==}
case 8n:
{==}
case 9n+_k:
{==}

# every digit time.iso writes is shaped '#'
law digit_shape:
Expand Down
52 changes: 18 additions & 34 deletions src/clock.bend
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,24 @@ def time.digit.at(place: Nat) -> Char:
match place:
case 0n:
'0'
case 1n+k1:
match k1:
case 0n:
'1'
case 1n+k2:
match k2:
case 0n:
'2'
case 1n+k3:
match k3:
case 0n:
'3'
case 1n+k4:
match k4:
case 0n:
'4'
case 1n+k5:
match k5:
case 0n:
'5'
case 1n+k6:
match k6:
case 0n:
'6'
case 1n+k7:
match k7:
case 0n:
'7'
case 1n+k8:
match k8:
case 0n:
'8'
case 1n+_k9:
'9'
case 1n:
'1'
case 2n:
'2'
case 3n:
'3'
case 4n:
'4'
case 5n:
'5'
case 6n:
'6'
case 7n:
'7'
case 8n:
'8'
case 9n+_k:
'9'

# the decimal digit of n's last place
def time.digit(num: U32) -> Char:
Expand Down
16 changes: 13 additions & 3 deletions src/errno.bend
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Base
def err.Table() -> Data:
List<&2, Sigma<&2, &2, U32, _ => String>>

# the common Linux codes and glibc's text for each, as os.strerror gives it
def err.table() -> err.Table():
# codes 1 to 25 and their texts
def err.table.low() -> err.Table():
[
(1, "Operation not permitted"),
(2, "No such file or directory"),
Expand All @@ -36,7 +36,12 @@ def err.table() -> err.Table():
(22, "Invalid argument"),
(23, "Too many open files in system"),
(24, "Too many open files"),
(25, "Inappropriate ioctl for device"),
(25, "Inappropriate ioctl for device")
]

# codes 26 to 125 and their texts
def err.table.high() -> err.Table():
[
(26, "Text file busy"),
(27, "File too large"),
(28, "No space left on device"),
Expand All @@ -63,6 +68,11 @@ def err.table() -> err.Table():
(125, "Operation canceled")
]

# the common Linux codes and glibc's text for each, as os.strerror gives it:
# the classic codes 1 to 25, then the rest
def err.table() -> err.Table():
List.append(&2, Sigma<&2, &2, U32, _ => String>, err.table.low(), err.table.high())

# what is written when hit holds, else what the rest writes
def err.when(hit: Bool, yes: Unit -> String, no: Unit -> String) -> String:
match hit:
Expand Down
17 changes: 13 additions & 4 deletions src/str.bend
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,8 @@ def text.lower.rules() -> List<&2, Rule>:
def text.lower.multi() -> List<&2, Multi>:
[Multi{304, "i\u{307}"}]

# Unicode 13's uppercase mappings (Python's str.upper) of U+0000 to U+017F
# and U+0370 to U+04FF that are one code point
def text.upper.rules() -> List<&2, Rule>:
# the uppercase rules of U+0000 to U+017F
def text.upper.rules.latin() -> List<&2, Rule>:
[
Rule{97, 122, 1, 65},
Rule{181, 181, 1, 924},
Expand All @@ -358,7 +357,12 @@ def text.upper.rules() -> List<&2, Rule>:
Rule{314, 328, 2, 313},
Rule{331, 375, 2, 330},
Rule{378, 382, 2, 377},
Rule{383, 383, 1, 83},
Rule{383, 383, 1, 83}
]

# the uppercase rules of U+0370 to U+04FF, Greek and Cyrillic
def text.upper.rules.greek() -> List<&2, Rule>:
[
Rule{881, 883, 2, 880},
Rule{887, 887, 1, 886},
Rule{891, 893, 1, 1021},
Expand Down Expand Up @@ -391,6 +395,11 @@ def text.upper.rules() -> List<&2, Rule>:
Rule{1233, 1279, 2, 1232}
]

# Unicode 13's uppercase mappings (Python's str.upper) of U+0000 to U+017F
# and U+0370 to U+04FF that are one code point
def text.upper.rules() -> List<&2, Rule>:
List.append(&2, Rule, text.upper.rules.latin(), text.upper.rules.greek())

# the uppercase mappings of U+00DF, U+0149, U+0390 and U+03B0 are more than
# one code point
def text.upper.multi() -> List<&2, Multi>:
Expand Down
Loading