27 lines
800 B
Python
27 lines
800 B
Python
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
|
|
|
from bu4.evaluation.av.envtype import envtype
|
|
from bu4.evaluation.av.lambdaenv import LambdaEnv
|
|
from bu4.evaluation.constructs.elinked import ELinked
|
|
from bu4.evaluation.constructs.evaluable import Evaluable
|
|
from bu4.evaluation.constructs.evalue import EValue
|
|
from bu4.linking.constructs.linked import Linked
|
|
|
|
__all__ = ('ELambda',)
|
|
|
|
|
|
class ELambda(EValue):
|
|
def __init__(self, env: envtype, name: bytes, value: Linked):
|
|
self.env = env
|
|
self.name = name
|
|
self.value = value
|
|
|
|
def call(self, argument: Evaluable) -> Evaluable:
|
|
return ELinked(
|
|
LambdaEnv(self.env, self.name, argument),
|
|
self.value
|
|
)
|
|
|
|
def __str__(self):
|
|
return f'({self.name.decode()}){self.value}'
|