Bitset.word_desc: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/containers/bitset.bend as Bitset Lines 283-294 of bend-collections@1.0.0.0/src/containers/bitset.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/containers/bitset.bend&start_line=283&end_line=294 import Base # Indices of set bits, ascending. Walks the words from the last to the first # so the list is built in ascending order without an append. # The members of one word, by two TAIL loops: the set offsets are pushed in # DESCENDING order onto a scratch list (low bit first), which is then # reversed onto rest -- the same list word_members builds, without its # non-tail recursion. def word_desc(m: Nat, +w: U32, +off: Nat, acc: List<&2, Nat>) -> List<&2, Nat>: match m: case 0n: acc case 1n+p: word_desc(p, U32.shr(w), 1n+off, member_pick(low(w), off, acc)) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shr https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/bitset.bend&name=low https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/bitset.bend&name=member_pick