def thread_first(val, *forms):
    def evalform_front(val, form):
        if callable(form):
            return form(val)
        if isinstance(form, tuple):
            func, args = form[0], form[1:]
            args = (val,) + args
            return func(*args)
    return reduce(evalform_front, forms, val)
Solve linear system with QR or LQ factorization.
dataset/ETHPy150Open pytoolz/toolz/toolz/functoolz.py/thread_first--crossover with--dataset/ETHPy150Open lebedov/scikit-cuda/skcuda/cula.py/culaDeviceZgels