1
1
mirror of https://github.com/kanaka/mal.git synced 2024-10-27 14:52:16 +03:00
mal/impls/python
Nicolas Boulenguez 37f62250a4 python: various simplifications
Use raw or multiline string litterals to make some hard-coded strings
more readable.

Replace some lambda constructs with more idiomatic generator
expressions, removing several temporary sequences (conversions,
contatenations, slices, arguments).

Replace definitions with assignments when possible.

Replace most python2/3 wrappers with code compatible with both
versions.  Use a non-printable ASCII characters instead of Unicode
characters (in order to avoid unicode in python2).

core:
Close file open by 'slurp' after reading.
coll_Q: remove as obsolete.
conj: do not preserve metadata.

env:
Replace find with an optional argument to get.
Search in outer environments with a loop instead of a recursion.
(python is not intended for large recursions).

readline:
Copy the example from the docs.
Write the history once.

mal_types:
clone: copy.copy() everything except callables.
functions: construct fn* functions in steps, where they are used
  (there was no encapsulation anyway)
Derive List and Vector from tuple, which is more efficient than list
for immutable structures.  Remove the need for __getitem__ stuff.
maps: provide an asPairs iterator.

printer:
Introduce a pr_list helper like many other implementations.

steps:
Remove obviously backported stuff from first steps.
Port forward the limitation of the exception backtrace size from step5
to later steps, so that REGRESS=1 does not crash stepA tests.
Fix the detection of special forms (strings were accepted as well as
symbols).
Let try* benefit from TCO.
2024-08-08 10:10:13 -05:00
..
tests Move implementations into impls/ dir 2020-02-10 23:50:16 -06:00
core.py python: various simplifications 2024-08-08 10:10:13 -05:00
Dockerfile dockerfiles: improve consistency, link python to python3 2024-08-05 17:02:34 -05:00
env.py python: various simplifications 2024-08-08 10:10:13 -05:00
Makefile Move implementations into impls/ dir 2020-02-10 23:50:16 -06:00
mal_readline.py python: various simplifications 2024-08-08 10:10:13 -05:00
mal_types.py python: various simplifications 2024-08-08 10:10:13 -05:00
printer.py python: various simplifications 2024-08-08 10:10:13 -05:00
reader.py python: various simplifications 2024-08-08 10:10:13 -05:00
run Move implementations into impls/ dir 2020-02-10 23:50:16 -06:00
step0_repl.py python: various simplifications 2024-08-08 10:10:13 -05:00
step1_read_print.py python: various simplifications 2024-08-08 10:10:13 -05:00
step2_eval.py python: various simplifications 2024-08-08 10:10:13 -05:00
step3_env.py python: various simplifications 2024-08-08 10:10:13 -05:00
step4_if_fn_do.py python: various simplifications 2024-08-08 10:10:13 -05:00
step5_tco.py python: various simplifications 2024-08-08 10:10:13 -05:00
step6_file.py python: various simplifications 2024-08-08 10:10:13 -05:00
step7_quote.py python: various simplifications 2024-08-08 10:10:13 -05:00
step8_macros.py python: various simplifications 2024-08-08 10:10:13 -05:00
step9_try.py python: various simplifications 2024-08-08 10:10:13 -05:00
stepA_mal.py python: various simplifications 2024-08-08 10:10:13 -05:00