Hey, Simon Tournier <zimon.touto...@gmail.com> skribis:
> Re ‘match’ penalty: when using ellipses in patterns, the generated > code checks for “proper lists”, which is O(n). The trick is to > instead match a pair: > > ✔ (match lst ((head . tail) …)) > ❎ (match lst ((head tail ...) …)) To clarify, my message should not be understood as “never use ellipses in ‘match’ patterns”. Whether using ellipses is a “penalty” depends on the context. In some cases I use ellipses anyway because it’s more accurate, more pleasant to the eye, because the input list is small, and/or because this is not performance-critical code. Having a disjoint type for proper lists would avoid this problem, as I mentioned on the Fediverse, but we’re not there yet… Ludo’.