uiua-lang/uiua

Many small optimization.

Closed this issue · 2 comments

Some code can be optimized. So, this is the list of optimization:

  1. even flip : are identity ∘.
  2. odd flip : are single flip :.
  3. /+⇡ are the triangular number.
  4. /×⇡ are the factorial number.
  5. deshape ♭ a shape [n] array is the identity ∘ with the array.
  6. each ∵ with a pervasive function is the pervasive function itself.

In general, I don't like to add optimizations for things that can be done another way.

  1. :: has signature |2.2 while has signature |1.1
  2. I think you can just not write more than 1 flip. There's a case for multiple flips ending up next to each other because in a macro, but I don't think that would be common enough to warrant special casing.
  3. While this could be optimized, I don't think it's necessary.
  4. /×⇡ is 0.
  5. This is implemented
  6. This is the most compelling one because of macros. I may implement it.

5 is implemented in c72ab27