21 lines
541 B
Python
21 lines
541 B
Python
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
|
from bu4.evaluation.constructs.elambda import ELambda
|
|
from bu4.evaluation.constructs.evalue import EValue
|
|
from bu4.evaluation.sync import sync
|
|
from bu4.tracing.probe import ProbeA
|
|
|
|
__all__ = ('trace',)
|
|
|
|
_probe_index = 0
|
|
|
|
|
|
def trace(lambda_: EValue):
|
|
global _probe_index
|
|
size = 0
|
|
while True:
|
|
if not isinstance(lambda_, ELambda):
|
|
return size, lambda_
|
|
lambda_ = sync(lambda_.call(ProbeA(_probe_index)))
|
|
_probe_index += 1
|
|
size += 1
|