Advent of code in OpenRefine

Hey folks, over the weekend I finally got started on a project I'd wanted to try this year: solving advent of code challenges within OpenRefine. I know we're already pretty late in the challenges but I wanted to see if anyone else is interested in giving this a try.

I've only made it past day 1 part 1, but to get there I added a reduce GREL function to transform arrays. I'm still working on part 2, but in the meantime here is my solution for part 1:

solution for advent of code day 1, part 1
  1. Import the data as a project with a single column
  2. Transform the input such that R numbers are positive and L numbers are negative
  3. Create a new column with where the dial ends up after the rotation in the current row
  4. Use a text facet to see how many zeros are in the project
reduce(
    forRange(
      0,
      row.index + 1,
      1,
      v,
      with(
        cross(v),
        prev,
        prev[0].cells["Column 1"].value
      )
    ),
    v,
    acc,
    50,
    with((acc + v) % 100, normalized,
      if(
        normalized > 99,
        abs(100 - normalized),
        if(
          normalized < 0,
          100 + normalized,
          normalized
        )
      )
  ))

I think Owen did this a few years ago. You should be able to find his messages in (one of) the archive(s).

Tom