mirror of
https://github.com/tweag/nickel.git
synced 2024-11-10 10:46:49 +03:00
Add reverse app operator and corresponding test
This commit is contained in:
parent
19730ced59
commit
f905606982
@ -398,6 +398,8 @@ InfixExpr: RichTerm = {
|
||||
#[precedence(level="6")] #[assoc(side="left")]
|
||||
<t1: WithPos<InfixExpr>> "&" <t2: WithPos<InfixExpr>> =>
|
||||
mk_term::op2(BinaryOp::Merge(), t1, t2),
|
||||
<t1: WithPos<InfixExpr>> "|>" <t2: WithPos<InfixExpr>> =>
|
||||
mk_app!(t2, t1),
|
||||
|
||||
#[precedence(level="7")] #[assoc(side="left")]
|
||||
<t1: WithPos<InfixExpr>> "<" <t2: WithPos<InfixExpr>> =>
|
||||
@ -576,6 +578,7 @@ extern {
|
||||
"fun" => Token::Normal(NormalToken::Fun),
|
||||
"import" => Token::Normal(NormalToken::Import),
|
||||
"|" => Token::Normal(NormalToken::Pipe),
|
||||
"|>" => Token::Normal(NormalToken::RightPipe),
|
||||
"->" => Token::Normal(NormalToken::SimpleArrow),
|
||||
"=>" => Token::Normal(NormalToken::DoubleArrow),
|
||||
"#" => Token::Normal(NormalToken::Hash),
|
||||
|
@ -130,6 +130,8 @@ pub enum NormalToken<'input> {
|
||||
Import,
|
||||
#[token("|")]
|
||||
Pipe,
|
||||
#[token("|>")]
|
||||
RightPipe,
|
||||
#[token("->")]
|
||||
SimpleArrow,
|
||||
#[token("=>")]
|
||||
|
@ -19,4 +19,12 @@ let Assert = fun l x => x || %blame% l in
|
||||
let r = {a=(inj 1),b=(cat "a" "b")} in
|
||||
%deepSeq% r (r.a.b) == 3 | #Assert) &&
|
||||
|
||||
([1,2,3]
|
||||
|> lists.map (fun x => x + 1)
|
||||
|> lists.filter (fun x => x > 2)
|
||||
|> builtins.serialize `Json
|
||||
|> builtins.deserialize `Json
|
||||
== [3,4]
|
||||
| #Assert) &&
|
||||
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user