Skip to content

Using dtm data as parameters #15

Description

@taylorbf

Hi Taka,
Great lib : ) I have a design question --

Some methods take DTM data as input, while others don't.

Let's use this as an example --

dtm.gen("sine").fit(10).amp(2)

I can use a dtm data object as input to the amp() method.

dtm.gen("sine").fit(10).amp( dtm.ri(200,0,1) )

But, there are other functions where I cannot use a dtm data object as input. fit() is one of those methods. This will not work:

dtm.gen("sine").fit( dtm.ri(1,5,10) ).amp(2)

I understand that

  1. this is an odd use case, because .fit() needs exactly one number as input
  2. I could use dtm.ri(1,5,10).get(0) to return the first number, which would work.

But I wonder what you think about the idea of allowing DTM arrays as inputs into more methods? This could become a more common use case if anyone wants to write DTM code that is evaluated more than once

Or, it could even open up new territories, for example, this could have a different 'fit' length for each of the 5 repetitions.

dtm.gen("line").rep(5).fit( dtm.ri(5,5,10) )

Let me know what you think!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions