48 lines
1.6 KiB
Markdown
48 lines
1.6 KiB
Markdown
_
|
|
=
|
|
|
|
This repository is (somewhat of) a Python port of mames [\_ module](https://github.com/mame/_)
|
|
for Ruby that allows you to write scripts by using _ exclusively.
|
|
|
|
Overview
|
|
--------
|
|
|
|
The following __script__ is a "Hello, world!"" program in \_:
|
|
|
|
```
|
|
____ _ _____ ____ __ _ ___ ______ ____ ____ _ ___ ____ __
|
|
___ __ _ _____ __ _ ____ ___ _ _ ___ _____ ______ ____ _ _
|
|
____ _ _ ____ _ ____ __ __ ___ _ ______ ___ ____ __ ______
|
|
____ _ ____ ____ __ _ ____ _ _ ___ _____ _____ _ ______
|
|
____ __ _ ____ __ _ ______
|
|
```
|
|
|
|
As in mames' original version, you can create such a __script__ easily:
|
|
|
|
* __script__(YourCodeAsAStringHere) will encode it raw
|
|
* __ruby_script__(YourCode) will encode it and add a "require"
|
|
* __python_script__(YourCode) will encode it and add an "import"
|
|
|
|
If you have a file containing _ code, you can import it after importing
|
|
_. Cool, huh?
|
|
|
|
Please note that the file you are importing is either an `.us` file or import
|
|
it by the fully qualified name(e.g. `import _.py`). This is to avoid confusion
|
|
with actual python modules. I can bring back the feature of including Python
|
|
modules, if you want me to, though.
|
|
|
|
The idea behind it is using Pythons import hooks to achieve something similar
|
|
to mames' original script, only that it works the opposite way.
|
|
|
|
Install
|
|
-------
|
|
|
|
Issue `python setup.py install`.
|
|
|
|
Why is the code so ugly?
|
|
------------------------
|
|
|
|
That is due to me wanting the encoding and decoding be kept as close as possible
|
|
to the original, even if the module has a completely different structure, which
|
|
means that I reimplemented a few Ruby functions from the Ruby standard in Python.
|