exercism / roc

Exercism exercises in Roc.
https://exercism.org/tracks/roc
MIT License
10 stars 7 forks source link

Add saddle-points exercise #118

Closed ageron closed 1 month ago

ageron commented 1 month ago

My solution is really verbose. Sometimes I don't really know how to solve a simple problem without a full page of code in Roc, with a lot of error handling. I mean here's the equivalent code in Python, it took me about 2 minutes to write. I'm not quite there yet in Roc:

matrix = [[1,5,3],[1,4,3],[1, 2, 2]]
result = [{"row": y + 1, "column": x + 1} for (y, row) in enumerate(matrix) for (x, val) in enumerate(row)
if val == max(row) and val == min((0 if len(r) < x else r[x]) for r in matrix)]
Anton-4 commented 1 month ago

Thanks for bringing this up @ageron, I've created https://github.com/roc-lang/roc/issues/7118 for this.