{ "my-add": { "NodeType": "LambdaExpr", "Parameters": [ { "NodeType": "Identifier", "Name": "a" }, { "NodeType": "Identifier", "Name": "b" } ], "Body": { "NodeType": "BinaryExpr", "Operator": "+", "Left": { "NodeType": "Identifier", "Name": "a" }, "Right": { "NodeType": "Identifier", "Name": "b" } } }, "my-square": { "NodeType": "LambdaExpr", "Parameters": [ { "NodeType": "Identifier", "Name": "x" } ], "Body": { "NodeType": "BinaryExpr", "Operator": "*", "Left": { "NodeType": "Identifier", "Name": "x" }, "Right": { "NodeType": "Identifier", "Name": "x" } } }, "my-3": { "NodeType": "LambdaExpr", "Parameters": [ { "NodeType": "Identifier", "Name": "a" }, { "NodeType": "Identifier", "Name": "b" }, { "NodeType": "Identifier", "Name": "c" } ], "Body": { "NodeType": "BinaryExpr", "Operator": "+", "Left": { "NodeType": "BinaryExpr", "Operator": "+", "Left": { "NodeType": "Identifier", "Name": "a" }, "Right": { "NodeType": "Identifier", "Name": "b" } }, "Right": { "NodeType": "Identifier", "Name": "c" } } }, "repeat": { "NodeType": "MacroDef", "Name": { "NodeType": "Identifier", "Name": "repeat" }, "Parameters": [ { "NodeType": "Identifier", "Name": "n" }, { "NodeType": "Identifier", "Name": "body" } ], "Body": { "NodeType": "Quasiquote", "Expression": { "NodeType": "Block", "Expressions": [ { "NodeType": "VarDecl", "Identifier": { "NodeType": "Identifier", "Name": "loop" }, "Initializer": { "NodeType": "LambdaExpr", "Parameters": [ { "NodeType": "Identifier", "Name": "counter" } ], "Body": { "NodeType": "IfExpr", "Condition": { "NodeType": "BinaryExpr", "Operator": ">", "Left": { "NodeType": "Identifier", "Name": "counter" }, "Right": { "NodeType": "Constant", "Value": { "Kind": "Scalar", "Value": { "Kind": "Ordinal", "Value": 0 } } } }, "ThenBranch": { "NodeType": "Block", "Expressions": [ { "NodeType": "Unquote", "Expression": { "NodeType": "Identifier", "Name": "body" } }, { "NodeType": "Recur", "Arguments": [ { "NodeType": "BinaryExpr", "Operator": "-", "Left": { "NodeType": "Identifier", "Name": "counter" }, "Right": { "NodeType": "Constant", "Value": { "Kind": "Scalar", "Value": { "Kind": "Ordinal", "Value": 1 } } } } ] } ] }, "ElseBranch": { "NodeType": "Block", "Expressions": [ ] } } } }, { "NodeType": "FunctionCall", "Callee": { "NodeType": "Identifier", "Name": "loop" }, "Arguments": [ { "NodeType": "Unquote", "Expression": { "NodeType": "Identifier", "Name": "n" } } ] } ] } } }, "factorial": { "NodeType": "LambdaExpr", "Parameters": [ { "NodeType": "Identifier", "Name": "n" } ], "Body": { "NodeType": "FunctionCall", "Callee": { "NodeType": "LambdaExpr", "Parameters": [ { "NodeType": "Identifier", "Name": "n" }, { "NodeType": "Identifier", "Name": "acc" } ], "Body": { "NodeType": "TernaryExpr", "Condition": { "NodeType": "FunctionCall", "Callee": { "NodeType": "Identifier", "Name": "<=" }, "Arguments": [ { "NodeType": "Identifier", "Name": "n" }, { "NodeType": "Constant", "Value": { "Kind": "Scalar", "Value": { "Kind": "Ordinal", "Value": 1 } } } ] }, "ThenBranch": { "NodeType": "Identifier", "Name": "acc" }, "ElseBranch": { "NodeType": "Recur", "Arguments": [ { "NodeType": "FunctionCall", "Callee": { "NodeType": "Identifier", "Name": "-" }, "Arguments": [ { "NodeType": "Identifier", "Name": "n" }, { "NodeType": "Constant", "Value": { "Kind": "Scalar", "Value": { "Kind": "Ordinal", "Value": 1 } } } ] }, { "NodeType": "FunctionCall", "Callee": { "NodeType": "Identifier", "Name": "*" }, "Arguments": [ { "NodeType": "Identifier", "Name": "acc" }, { "NodeType": "Identifier", "Name": "n" } ] } ] } } }, "Arguments": [ { "NodeType": "Identifier", "Name": "n" }, { "NodeType": "Constant", "Value": { "Kind": "Scalar", "Value": { "Kind": "Ordinal", "Value": 1 } } } ] } } }