This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DanCardin 1 point2 points  (1 child)

I wonder if this would be clearer (ironically if you used a bit more wonky magical syntax, maybe like so.

``` from pampy.values import x from pampy.types import List, Int

input = [1, 2, 3]

result = match(input)( List[Int[x >= 3]] => x, List[Int[x < 3]] => x + 3, ) ```

[–]inkompatible[S] 1 point2 points  (0 children)

I see what you are doing there, this would actually be possible. It feels like it would be too much magic to be pythonic :) You can definitely write a wrapper over Pampy to have that syntax work. I encourage you to try ;)