logoalt Hacker News

Variation on Iota

16 pointsby aebtebetenlast Monday at 9:09 AM2 commentsview on HN

Comments

mlochbaumtoday at 1:53 PM

Ooh, I've run into this one before! I'm a big fan of interval index[0], which performs a binary search, so Josh's suggestion is the one I prefer as well (the implementation might sometimes optimize by transforming it into a table lookup like the other solutions). Searching for +`≠¨ in my BQN files turns up a few uses, including one used to group primitives into types in a utility involved in compiling BQN[1] and an annotated function used a few times in the markdown processor that builds BQN's website[2].

[0] https://aplwiki.com/wiki/Interval_Index

[1] https://github.com/mlochbaum/BQN/blob/717555b0db/src/pr.bqn#...

[2] https://github.com/mlochbaum/BQN/blob/717555b0db/md.bqn#L45-...

xenonitetoday at 1:38 PM

This is about the APL language.

std::iota is influenced by APL, see Notes in https://en.cppreference.com/w/cpp/algorithm/iota.html