algebraic-data-type

Algebraic data type and pattern matching


License
MIT
Install
pip install algebraic-data-type==0.0.4

Documentation

Algebraic Data Type

To install the package pip install algebraic-data-type

ADT

[To be written]

Pattern Matching

from adt import Multimethod

 with Multimethod() as fib: 
        fib[1] = 1 
        fib[2] = 1 
        fib[int] =  lambda x: fib(x-1) + fib(x-2)

example

Test

To run the tests, clone the repo and use pytest

>>> git clone https://github.com/catethos/adt.git

>>> cd adt/

>>> pytest