These are chat archives for evhub/coconut

Mar 2017
Evan Hubinger
Mar 20 2017 18:04
@hasufell If you don't like addpattern, what about
def func(xs):
    case xs:
        match []: ...
        match [x]: ...
        match xs: ...
Julian Ospald
Mar 20 2017 19:31
@evhub that's inside the function
when I have functions that behave fundamentally different in terms of codepath wrt input I like to see that immediately
Evan Hubinger
Mar 20 2017 19:56

@hasufell Yeah, I agree with that, and that's what addpattern is for. So the best way to do that would be

def func([]) = ...
def func([x]) = ...
def func(xs) = ...

I agree that for small functions like that it can look clunky, but I'm not sure what a better way to do it would be. Thoughts?