MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / lispstr

Function lispstr

02-array-seq/lispy/py3.10/lis.py:132–137  ·  view source on GitHub ↗

Convert a Python object back into a Lisp-readable string.

(exp: object)

Source from the content-addressed store, hash-verified

130 print(lispstr(val))
131
132def lispstr(exp: object) -> str:
133 "Convert a Python object back into a Lisp-readable string."
134 if isinstance(exp, list):
135 return '(' + ' '.join(map(lispstr, exp)) + ')'
136 else:
137 return str(exp)
138# end::REPL[]
139
140

Callers 3

standard_envFunction · 0.70
replFunction · 0.70
evaluateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected