pykot

Porting some Python / Kotlin features to Nim


Keywords
library, python, kotlin, nim, nimlang
License
MIT
Install
nimble install pykot

Documentation

NimPyKot

Porting some Python / Kotlin features to Nim.

Installation

$ nimble install pykot

Or, simply copy the file src/pykot.nim to your project folder and import it.

To install the latest development version, issue the following command:

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

With nimble uninstall pykot you can remove the package.

Notes

The project was inspired by https://github.com/Yardanico/nimpylib.

Sample

Take an integer and reverse it. The result must also be an integer. Example: 1977 → 7791.

import unicode
import pykot

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

let n = 2018

echo n
echo reverse_number(n)

Output:

2018
8102