Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prev()?.newValue() unavailable for add-multiple DSL #614

Open
Jolanrensen opened this issue Mar 4, 2024 · 0 comments
Open

prev()?.newValue() unavailable for add-multiple DSL #614

Jolanrensen opened this issue Mar 4, 2024 · 0 comments
Labels
bug Something isn't working research
Milestone

Comments

@Jolanrensen
Copy link
Collaborator

As is described here, adding a single column allows you to access the previous row with prev() and the new value of the previous row with prev().newValue<T>().

This enables:

df.add("fibonacci") {
    if (index() < 2) 1
    else prev()!!.newValue<Int>() + prev()!!.prev()!!.newValue<Int>()
}

I'd expect this to be equivalent:

df.add {
    "fibonacci" from {
        if (index() < 2) 1
        else prev()!!.newValue<Int>() + prev()!!.prev()!!.newValue<Int>()
    }
}

but unfortunately, since from {} provides a DataRow as context instead of AddDataRow, newValue() is unavailable.
I don't know whether this was done due to a technical limitation, but if it was an oversight it surely must be added.

@Jolanrensen Jolanrensen added bug Something isn't working invalid This doesn't seem right research labels Mar 4, 2024
@Jolanrensen Jolanrensen added this to the Backlog milestone Mar 4, 2024
@zaleslaw zaleslaw removed the invalid This doesn't seem right label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working research
Projects
None yet
Development

No branches or pull requests

2 participants