28 lines
886 B
Python
28 lines
886 B
Python
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
|
|
|
from bu4.evaluation.constructs.attachable import Attachable
|
|
from bu4.evaluation.constructs.eattachable import EAttachable
|
|
from bu4.evaluation.constructs.evaluable import Evaluable
|
|
from bu4.evaluation.constructs.etraceable import ETraceable
|
|
from bu4.indexing.evaluation.eivtype import eivtype
|
|
from bu4.indexing.evaluation.lambdaeiv import LambdaEiv
|
|
|
|
__all__ = ('EILambda',)
|
|
|
|
|
|
class EILambda(ETraceable):
|
|
def __init__(self, ev: eivtype, value: Attachable[eivtype], *, memoize: bool):
|
|
self.ev = ev
|
|
self.value = value
|
|
self.memoize = memoize
|
|
|
|
def call(self, argument: Evaluable) -> Evaluable:
|
|
ev: eivtype = LambdaEiv(self.ev, argument, memoize=self.memoize)
|
|
return EAttachable(
|
|
ev,
|
|
self.value
|
|
)
|
|
|
|
def __str__(self):
|
|
return f'(0){self.value}'
|