Oriel — AI & technology worth noticing, every day.

Parsing nested lists in BQN

Web page · https://saltysylvi.github.io/blog/parsing-nested-lists-in-bqn.html

First seen by Oriel on .

AI summary

The post implements three BQN approaches for parsing Advent of Code 2022 nested lists, comparing •BQN evaluation, recursive descent, and array-style depth-based parsing.

  • The •BQN approach converts square brackets to BQN angle brackets, but crashes on one giant input string and benchmarks at 0.074279465 when parsing individual lines.
  • The recursive descent implementation tokenizes brackets and numbers, then applies separate value, number, and list parsers under the assumption that input is valid.
  • Recursive descent handles both giant-string and per-line inputs, agrees with •BQN results, and benchmarks around 0.007 seconds, roughly ten times faster than •BQN.
  • The initial array-style parser groups tokens by nesting depth, folds from deepest groups outward, and replaces closing brackets with constructed sublists.
  • That array prototype produces matching results but benchmarks around 0.015 seconds, approximately twice as slow as recursive descent, motivating a flatter token representation for further optimization.

#bqn #parsing #array programming #advent of code

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Points

Score reported by the source.

  • Lobsters: 16, latest observation ; +15 over observed period since

Comments

Comment count reported by the source.

  • Lobsters: 1, latest observation ; +1 over observed period since

Aliases

SourceExternal IDURL
Lobstersnbjckzhttps://saltysylvi.github.io/blog/parsing-nested-lists-in-bqn.html Read discussion