mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
48 lines
678 B
Markdown
48 lines
678 B
Markdown
# META
|
|
~~~ini
|
|
description=Lambda with multiple arguments
|
|
type=expr
|
|
~~~
|
|
# SOURCE
|
|
~~~roc
|
|
|x, y| x + y
|
|
~~~
|
|
# EXPECTED
|
|
NIL
|
|
# PROBLEMS
|
|
NIL
|
|
# TOKENS
|
|
~~~zig
|
|
OpBar,LowerIdent,Comma,LowerIdent,OpBar,LowerIdent,OpPlus,LowerIdent,
|
|
EndOfFile,
|
|
~~~
|
|
# PARSE
|
|
~~~clojure
|
|
(e-lambda
|
|
(args
|
|
(p-ident (raw "x"))
|
|
(p-ident (raw "y")))
|
|
(e-binop (op "+")
|
|
(e-ident (raw "x"))
|
|
(e-ident (raw "y"))))
|
|
~~~
|
|
# FORMATTED
|
|
~~~roc
|
|
NO CHANGE
|
|
~~~
|
|
# CANONICALIZE
|
|
~~~clojure
|
|
(e-lambda
|
|
(args
|
|
(p-assign (ident "x"))
|
|
(p-assign (ident "y")))
|
|
(e-binop (op "add")
|
|
(e-lookup-local
|
|
(p-assign (ident "x")))
|
|
(e-lookup-local
|
|
(p-assign (ident "y")))))
|
|
~~~
|
|
# TYPES
|
|
~~~clojure
|
|
(expr (type "a, a -> a"))
|
|
~~~
|