NimPyKot Kotlin风Python糖移植库

Nim 里的 Kotlin 味 Python 糖,听着有点绕,实际用起来还挺香。NimPyKot把 Kotlin 和 Python 里一些常用的转换操作搬到了 Nim 上,像数字反转、字符串这些小操作,写起来干净利落。

reverse_number(n: int): int这个函数挺典型,传个整数进去,返回你一个反过来的结果,比如2018 → 8102,逻辑清楚,代码也简单:

import unicode
import pykot/converters

proc reverse_number(n: int): int = n.toStr().reversed().toInt()

let n = 2018 echo n # 2018 echo reverse_number(n) # 8102

想装包,直接nimble install pykot。图省事装最新开发版也行,用这个:

nimble install "https://github.com/jabbalaci/nimpykot@#head"

用腻了就nimble uninstall pykot,干净利索。API 文档也有,入口清晰,不怕找不到门。灵感来自 Python+Kotlin 的混合风味,适合写点转换逻辑的工具函数,或者你想在 Nim 里偷点语法糖的时候。

如果你平时写 Nim,又挺喜欢 Kotlin/Python 那套语法糖,NimPyKot这玩意值得一试,轻巧实用,写起来顺手。

zip
nimpykot-master.zip 预估大小:55个文件
folder
nimpykot-master 文件夹
file
.gitignore 69B
folder
src 文件夹
folder
pykot 文件夹
file
types.nim 148B
file
functional.nim 3KB
file
jtimes.nim 654B
file
web.nim 336B
file
strings.nim 6KB
file
console.nim 1KB
file
jrandom.nim 527B
file
process.nim 429B
file
euler.nim 699B
file
jsystem.nim 660B
file
converters.nim 2KB
file
fs.nim 2KB
file
pretty.nim 418B
file
pykot.nim 3KB
file
.travis.yml 351B
folder
samples 文件夹
file
.gitignore 15B
file
reverse_number.nim 151B
file
config.nims 37B
file
LICENSE 1KB
file
config.nims 34B
file
README.md 993B
folder
tests 文件夹
file
tfs.nim 8B
file
tpykot.nim 2KB
file
tweb.nim 8B
file
tfunctional.nim 1KB
file
tprocess.nim 481B
file
tjsystem.nim 126B
file
config.nims 36B
file
teuler.nim 315B
file
README.md 114B
file
ttypes.nim 148B
file
tconsole.nim 8B
file
tpretty.nim 309B
file
tstrings.nim 2KB
file
tconverters.nim 1KB
file
tjrandom.nim 223B
file
build.py 7KB
file
pykot.nimble 232B
folder
docs 文件夹
file
euler.html 32KB
file
pretty.html 31KB
file
strings.html 62KB
file
jtimes.html 33KB
file
converters.html 44KB
file
types.html 30KB
file
fs.html 35KB
file
jsystem.html 31KB
file
pykot.html 43KB
file
theindex.html 44KB
file
functional.html 45KB
file
process.html 32KB
file
web.html 31KB
file
index.html 44KB
file
console.html 33KB
file
jrandom.html 32KB
zip 文件大小:154.44KB