185 lines
7.2 KiB
Text
185 lines
7.2 KiB
Text
[
|
|
{"type":"KeywordNamespace","value":"import"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Name","value":"gleam"},
|
|
{"type":"Operator","value":"/"},
|
|
{"type":"Name","value":"io"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"NameAttribute","value":"@external"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"erlang"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"lists\""},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"reverse\""},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Keyword","value":"pub"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Keyword","value":"fn"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameFunction","value":"reverse_list"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"items"},
|
|
{"type":"Operator","value":":"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameClass","value":"List"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"e"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"-\u003e"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameClass","value":"List"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"e"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"NameFunction","value":"tail_recursive_reverse"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"items"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"[])"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"LiteralStringDoc","value":"/// Tail recursion!\n"},
|
|
{"type":"Keyword","value":"fn"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameFunction","value":"tail_recursive_reverse"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"items"},
|
|
{"type":"Operator","value":":"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameClass","value":"List"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"e"},
|
|
{"type":"Punctuation","value":"),"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Name","value":"reversed"},
|
|
{"type":"Operator","value":":"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameClass","value":"List"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"e"},
|
|
{"type":"Punctuation","value":"))"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"-\u003e"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameClass","value":"List"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"e"},
|
|
{"type":"Punctuation","value":")"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Keyword","value":"case"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Name","value":"items"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"[]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"-\u003e"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Name","value":"reversed"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"Name","value":"first"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":".."},
|
|
{"type":"Name","value":"rest"},
|
|
{"type":"Punctuation","value":"]"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"-\u003e"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameFunction","value":"tail_recursive_reverse"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"Name","value":"rest"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"["},
|
|
{"type":"Name","value":"first"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":".."},
|
|
{"type":"Name","value":"reversed"},
|
|
{"type":"Punctuation","value":"])"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n\n"},
|
|
{"type":"Keyword","value":"pub"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Keyword","value":"fn"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"NameFunction","value":"main"},
|
|
{"type":"Punctuation","value":"()"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"{"},
|
|
{"type":"TextWhitespace","value":"\n\t"},
|
|
{"type":"KeywordDeclaration","value":"let"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Name","value":"_thing"},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Operator","value":"="},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"Punctuation","value":"\u003c\u003c"},
|
|
{"type":"LiteralString","value":"\"Hello, Joe!\""},
|
|
{"type":"Operator","value":":"},
|
|
{"type":"Name","value":"utf8"},
|
|
{"type":"Punctuation","value":"\u003e\u003e"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Name","value":"io"},
|
|
{"type":"Operator","value":"."},
|
|
{"type":"NameFunction","value":"debug"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"reverse_list"},
|
|
{"type":"Punctuation","value":"(["},
|
|
{"type":"LiteralNumberInteger","value":"1"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"2"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"3"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"4"},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralNumberInteger","value":"5"},
|
|
{"type":"Punctuation","value":"]))"},
|
|
{"type":"TextWhitespace","value":"\n "},
|
|
{"type":"Name","value":"io"},
|
|
{"type":"Operator","value":"."},
|
|
{"type":"NameFunction","value":"debug"},
|
|
{"type":"Punctuation","value":"("},
|
|
{"type":"NameFunction","value":"reverse_list"},
|
|
{"type":"Punctuation","value":"(["},
|
|
{"type":"LiteralString","value":"\"a\""},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"b\""},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"c\""},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"d\""},
|
|
{"type":"Punctuation","value":","},
|
|
{"type":"TextWhitespace","value":" "},
|
|
{"type":"LiteralString","value":"\"e\""},
|
|
{"type":"Punctuation","value":"]))"},
|
|
{"type":"TextWhitespace","value":"\n"},
|
|
{"type":"Punctuation","value":"}"},
|
|
{"type":"TextWhitespace","value":"\n"}
|
|
]
|