Skip to content

Array element access in cycle #108

Description

@unlessgames

I think it could be a handy feature once we have parameter injection to have some syntax that can use an index to pick a single value from a subdivision.

For example writing

[[a b a b] [a a b b] [c c c c]]($index)

Would let you pick one of the three steps to output with an $index parameter, this could allow for both more human controlled playback or more complex procedural logic while still making use of the notation.

The syntax could either be like the above where a single value inside parens joined to a subdivision would mean this, or reusing the % sign like [a b c d]%$index.


In general this would be handy even without variable inputs like

[a b c]%<1 2 3 1 1 1 3>

that would generate a, b, c, a, a, a, c over time, essentially allowing you to reuse/rearrange any step patterns this way.


In terms of indexing, it might be nice to be able to use both normal values and integers, the integer index access would start from 1 and wrap around, but if you supply a value under 1, you could access the entire array with the float mapped to whatever length of the array is, so [a b c]%3 would output c but [a b c]%0.5 would output b etc.


Being able to take a ranged slice instead of a single element would also be nice but this alone seems useful as well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions