Skip to content

select map on array value works with table object but not with the underscore operator #9255

Answered by cpcloud
ophiry asked this question in Q&A
Discussion options

You must be logged in to vote

Reposting my answer from StackOverflow:

The underscore API in this context would be ambiguous here as to whether it refers to a lambda parameter or the outer table.

As I say here, there's no real reason to prevent use of the second case in a call to ArrayMap.

For example:

t.my_array_col.map(lambda x: _.a + x)

It's not clear how to reliably determine what the underscore means when mixed like in your original example, and we don't want to prevent valid uses of it in the underscore-as-outer-table use, so that's its meaning.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cpcloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants