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

Class Procedure

18-with-match/lispy/py3.9/lis.py:175–190  ·  view source on GitHub ↗

A user-defined Scheme procedure.

Source from the content-addressed store, hash-verified

173
174
175class Procedure:
176 "A user-defined Scheme procedure."
177
178 def __init__(
179 self, parms: list[Symbol], body: list[Expression], env: Environment
180 ):
181 self.parms = parms
182 self.body = body
183 self.env = env
184
185 def __call__(self, *args: Expression) -> Any:
186 local_env = dict(zip(self.parms, args))
187 env = Environment(local_env, self.env)
188 for exp in self.body:
189 result = evaluate(exp, env)
190 return result
191
192
193################ command-line interface

Callers 1

evaluateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected