This PR implements iteration over ranges for `Fin` and `Char`. To this end, we introduce machinery for pulling back lawfulness of `UpwardEnumerable` along an injective map and study the function `Char.ordinal : Char -> Fin Char.numCodePoints`.
29 lines
492 B
Text
29 lines
492 B
Text
module
|
|
|
|
def s₁ : String := Id.run do
|
|
let mut ans := ""
|
|
for c in 'a'...='z' do
|
|
ans := ans.push c
|
|
return ans
|
|
|
|
/-- info: "abcdefghijklmnopqrstuvwxyz" -/
|
|
#guard_msgs in
|
|
#eval s₁
|
|
|
|
def s₂ : String := Id.run do
|
|
let mut ans := ""
|
|
for c in 'a'...'z' do
|
|
ans := ans.push c
|
|
return ans
|
|
|
|
/-- info: "abcdefghijklmnopqrstuvwxy" -/
|
|
#guard_msgs in
|
|
#eval s₂
|
|
|
|
/-- info: 122 -/
|
|
#guard_msgs in
|
|
#eval (*...'z').size
|
|
|
|
/-- info: 1112064 -/
|
|
#guard_msgs in
|
|
#eval (*...* : Std.Rii Char).size
|