question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature-request] Allow implicit function application syntax for nested index expressions

See original GitHub issue

Currently

# we can do
ys = list(map(.[0], xs))
# and
ys = list(map(.[0, 1], xs))
# but not
ys = list(map(.[0][1], xs))

This nesting is supported in the case of attrgetter, but not itemgetter. Instead of compiling to a closure (which we have to do by hand right now, anyway), it can instead compile to an expression of a new built-in function that basically does a ‘nested-get’ on __getitem__-able objects.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
evhubcommented, Mar 4, 2019

@narfanar As a simple workaround, you could do

ys = list(map(.[0] ..> .[1], xs))

which is probably what .[0][1] will get compiled to if this gets implemented.

1reaction
pavelbraginskiycommented, Mar 11, 2019

If this is implemented I think .[x].someattr[y].otherattr or other arbitrary combination of indexing and attribute access should be allowed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

produce map/object from nested for loop in terraform >0.12
I think there are two feature requests implicit in this issue: nested for expressions, and a function or functions that support creating ...
Read more >
Allow nested foralls and contexts in prefix GADT constructors
In fact, having nested forall s is an implicit requirement an already accepted GHC proposal, A syntax for visible dependent quantification.
Read more >
Implicit Differentiation With Partial Derivatives ... - YouTube
This Calculus 3 video tutorial explains how to perform implicit differentiation with partial derivatives using the implicit function theorem ...
Read more >
Release 2.6.1.1 The Agda Team - Agda User Manual
This is the manual for the Agda programming language, its type checking, compilation and editing system and related resources/tools.
Read more >
Adventures in the Terraform DSL, Part III: Iteration ...
List comprehensions in Python; For expressions; Example 6: Transforming ... which for the first time allow generation of nested blocks like ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found