Skip to content

Usage

As a script

Write the following code to hello.she, and then run mingshe ./hello.she.

1
"hello world" |> print

As a module

Just like use a python module, you can use a MíngShé module.

1
2
3
# lib.she
def digit_sum(s: str) -> int:
    return s |> map(int, ?) |> sum
1
2
3
4
# main.py
from lib import digit_sum

print(digit_sum('123456'))

Compile to python

Use mingshe --compile ... to compile to Python code, and it can be compiled to the specified Python version: mingshe --compile --python 2.7 ....

Run short code

Just try mingshe -c "9 ** 106 |> print".

Also, you can use mingshe --compile -c "9 ** 106 |> print".