The console module gives Lion programs a way to emit output during evaluation. Both functions write to the console and then return the logged value, so they can be used inside a begin block without discarding a result you still need.
Functions
console/log
Logs a message string to the console and returns the message.
Output: hello
Return value: "hello"
console/log-json
Pretty-prints any value as JSON with two-space indentation, then returns the formatted string. Useful for inspecting objects and arrays during development.
["console/log-json", {"hello": "world"}]
Output:
Return value: "{\n \"hello\": \"world\"\n}"
Logging inside a sequence
Because both functions return the value they log, you can place them inside a begin block without interrupting the flow of your program:
["begin",
["define", "result", ["number/add", 1, 2]],
["console/log-json", "result"],
"result"]
console/log and console/log-json use Effect’s Console.log under the hood. In test environments that provide a custom Effect console layer, output may be captured rather than printed to stdout.
During development, wrap intermediate values with console/log-json to inspect them in place. Remove the wrapper once you are satisfied with the result — the surrounding expression is unaffected because both functions return the value they receive.