26 lines
711 B
Plaintext
26 lines
711 B
Plaintext
import t
|
||
|
||
# ============================================================
|
||
# 内置函数(Python 语义,自动与 builtins 关联,无需显式 import)
|
||
# ord: 字符 → ASCII 码(int)
|
||
# chr: ASCII 码 → 字符(t.CChar)
|
||
# min/max: 数值比较取小/大值(double 参数,int/float 实参经
|
||
# coerce_to_type 无损提升;返回值由调用侧 coerce 到目标类型)
|
||
# ============================================================
|
||
|
||
def ord(s: t.CChar) -> int:
|
||
return s
|
||
|
||
def chr(i: int) -> t.CChar:
|
||
return i
|
||
|
||
def min(a: double, b: double) -> double:
|
||
if a < b:
|
||
return a
|
||
return b
|
||
|
||
def max(a: double, b: double) -> double:
|
||
if a > b:
|
||
return a
|
||
return b
|