Skip to content
\n

which is very sleek and elegant. However, what would be even more convenient is

\n
tweets | find(.Content contains \"Hello\") | .User\n
\n

Is there anything I'm missing to make this work?

\n

There's

\n
tweets | find(.Content contains \"Hello\") | get(\"User\")\n
\n

but now you're losing type-safety, I suppose.

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

In Expr, pipes designed to always work with function. Expr parser checks if there is a function call after a pipe. This approach simplifies a lot of things and makes syntax consistent.

\n

One way to solve it is to use variables.

\n
let user = tweets | find(.Content contains \"Hello\"); \nuser.User
\n

The get built-in keep it's type information. It's a special built-in and have a special handling in type check.

","upvoteCount":2,"url":"https://github.com/expr-lang/expr/discussions/780#discussioncomment-12741787"}}}
Discussion options

You must be logged in to vote

In Expr, pipes designed to always work with function. Expr parser checks if there is a function call after a pipe. This approach simplifies a lot of things and makes syntax consistent.

One way to solve it is to use variables.

let user = tweets | find(.Content contains "Hello"); 
user.User

The get built-in keep it's type information. It's a special built-in and have a special handling in type check.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stephanos
Comment options

@antonmedv
Comment options

@stephanos
Comment options

Answer selected by stephanos
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