Introduce pipe operator |> #862

Merged
ghallak merged 3 commits from ghallak/230 into master 2022-04-12 18:40:32 +09:00
2 changed files with 19 additions and 0 deletions
Showing only changes of commit 70bf1c6201 - Show all commits

View File

@ -218,6 +218,7 @@ compilable_contracts() ->
"using_namespace", "using_namespace",
"assign_patterns", "assign_patterns",
"patterns_guards", "patterns_guards",
"pipe_operator",
"test" % Custom general-purpose test file. Keep it last on the list. "test" % Custom general-purpose test file. Keep it last on the list.
]. ].

View File

@ -0,0 +1,18 @@
contract Main =
function is_negative(x : int) =
if (x < 0)
true
else
false
function inc_by_one(x : int) = x + 1
function inc_by_two(x : int) = x + 2
type state = bool
entrypoint init(x : int) = x
|> inc_by_one
|> inc_by_one
|> inc_by_two
|> ((x) => x * 5)
|> is_negative