diff --git a/free_flow/lib.py b/free_flow/lib.py index b174afd..ec86654 100644 --- a/free_flow/lib.py +++ b/free_flow/lib.py @@ -10,8 +10,6 @@ T = TypeVar('T') W = TypeVar('W') -# def map(fn: Callable[[T], W]): -# pass def Noop(x): return x @@ -35,20 +33,13 @@ def ret(x): from segments import ff # TODO: print the graph! https://github.com/pydot/pydot -# TODO: make a flatten utility? and a *apply utility? (eg. something turns arr into arr[arr], then i want to apply smt to each thing of the inner +# TODO: make a flatten utility? if __name__ == '__main__': x = ff('hello', eager=True)( Inspect("initial"), T( Print, [ord, lambda x: x**2 ]), Inspect("after tee")) - - - - - - - # data pipe: # 'hello' --- print --- + --- print ----| diff --git a/free_flow/segments.py b/free_flow/segments.py index ef05a7b..94dac45 100644 --- a/free_flow/segments.py +++ b/free_flow/segments.py @@ -18,13 +18,6 @@ def __repr__(self): class Segment(ABC): def __init__(self): pass - # self._eager = False - # @property - # def eager(self): - # return self._eager - # @eager.setter - # def eager(self, v: bool): - # self._eager = v @abstractmethod def __call__(self): @@ -124,7 +117,7 @@ def __init__(self, *segs: List[Segment]): self.segs = segs def __call__(self, x): for f in self.segs: try: - console.print(f"[green]{type(x).__name__}[/green] ➡️ {repr(f)}") + # console.print(f"[green]{type(x).__name__}[/green] ➡️ {repr(f)}") x = f(x) # optm: add vectorizability except Exception as e: raise FlowError(e, f, x)